TableLayout には、各行にTextView
andがありEditText
ます。EditText
複数の行がある場合はTableRow
ラップしますが、 の場合はラップTextEdit
しません..
簡単なレイアウト:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:shrinkColumns="*" >
<TableRow>
<TextView
android:id="@+id/textView1"
android:text="Lorem ipsum dolor sit amet, consectetur" />
<EditText
android:id="@+id/textView2"
android:text="Foo" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/textView3"
android:text="Foo" />
<EditText
android:id="@+id/textView4"
android:text="Lorem ipsum dolor sit amet, consectetur" />
</TableRow>
</TableLayout>
レンダリング:
ただし、両方のコントロールがTextEdit
の場合、正しくレンダリングされます。
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:shrinkColumns="*" >
<TableRow>
<TextView
android:id="@+id/textView1"
android:text="Lorem ipsum dolor sit amet, consectetur" />
<TextView
android:id="@+id/textView2"
android:text="Foo" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/textView3"
android:text="Foo" />
<TextView
android:id="@+id/textView4"
android:text="Lorem ipsum dolor sit amet, consectetur" />
</TableRow>
</TableLayout>
次のようにレンダリングします。
Androidが最初のレイアウトを正しくレンダリングするにはどうすればよいですか?
android:layout_width="fill_parent"
Ps: , android:layout_height="wrap_content
" 属性をTableRow
, TextView
,EditText
コントロールに追加しようとしましたが、何も変わっていません。