Как создать панель параметров - PullRequest
0 голосов
/ 06 декабря 2011

Я хочу создать панель с различными виджетами, как это ..

enter image description here

Вместо двух китайских ящиков я хочу показать спиннер и область редактирования текста.Внизу этой панели находится список просмотра.

любой Кто-нибудь знает, как создать это?

Что я пробовал ...

 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
     android:orientation="vertical"   
     android:layout_width="fill_parent"
     android:layout_height="wrap_content">

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >
 <Spinner
      android:id="@+id/spinner" 
      android:layout_width="0dip"
      android:layout_height="wrap_content" 
      android:prompt="@string/country"  
      android:layout_weight="1"/>
 <EditText 
   android:id="@+id/edittextserach"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:text="Search here"
   android:layout_weight="1"

   />
 <ImageButton 
  android:id="@+id/imagesearch"
  android:src="@drawable/search_icon"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:clickable="true"
  android:layout_weight="0"
  android:layout_marginBottom="8dip"
  android:paddingBottom="12dip"/>
 </LinearLayout>

<ListView 
  android:id="@+id/android:list"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content" />"
 </LinearLayout>

Я знаю, что мой макет странныйно я не могу найти учебник по этому вопросу.Я новичок в этом типе макетов.

enter image description here

Ответы [ 2 ]

1 голос
/ 06 декабря 2011

Попробуйте ограничить свой EditText следующим образом

Выберите maxWidth, которые имеют смысл. А включение scrollHorizontally гарантирует, что оно будет отображаться в одной строке даже после ввода длинного текста.

android:maxWidth="100dip"   
android:scrollHorizontally="true"

Полный макет для EditText:

 <EditText
        android:id="@+id/edittextserach"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:maxWidth="100dip"
        android:scrollHorizontally="true"
        android:text="Search here" />
0 голосов
/ 06 декабря 2011

Использование android: maxWidth Атрибут

<EditText 
   android:id="@+id/edittextserach"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:text="Search here"
   android:layout_weight="1"
   android:maxWidth="20sp"
 />
...