同じ水平線上にEditTextとButtonが隣り合っています。EditTextユーザーが大量のテキストを入力した場合、 のサイズが変更された場合、がつぶれた場合を除いて、見栄えは良いButtonです。
私は両方を持っておりEditText、にButton設定していlayout_width="wrap_content"ます。 "fill_parent"レイアウトが台無しになり、必要がない場合は絶対サイズを使用したくありません-現在の方法は、横向きと縦向きの両方で見栄えがよく、EditTextサイズを変更したくないだけです.
私のレイアウト:
<TableLayout
android:id="@+id/homelayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableRow>
<TextView
android:id="@+id/labelartist"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Find artists:" />
</TableRow>
<TableRow>
<EditText
android:id="@+id/entryartist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="6"
android:background="@android:drawable/editbox_background"
android:editable="true"
android:padding="5px"
android:singleLine="true" />
<Button
android:id="@+id/okartist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dip"
android:layout_weight="1"
android:text="Search" />
</TableRow>
</TableLayout>
