私はTableLayout
に現在3行あり、各行には1人の子供、TextView
があります。私の問題は、TextViews
の幅は"match_parent"
ではありません。私はそれらの高さと幅を定義しない手順(like the documentation says)に従っていますが、なんらかの理由で問題が残っています。Android TableRowの子供の問題
私はを開いて値を調べましたが、TableRow
は幅を塗りつぶしますが、TextView
は行を埋めるものではなく、内容をラップしています。完全なXMLレイアウトは以下の通りですが、他のアイデアはありますか?
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:background="@drawable/textlines"
android:text="@string/text1_string"
android:textColor="#000000"
android:padding="5dp">
</TextView>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:background="@drawable/textlines"
android:text="@string/text1_string"
android:textColor="#000000"
android:padding="5dp">
</TextView>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:background="@drawable/textlines"
android:text="@string/text1_string"
android:textColor="#000000"
android:padding="5dp">
</TextView>
</TableRow>
</TableLayout>
また、私は@drawable/textlines
のためのxmlファイルが含まれます。おそらく問題はそこにありますか? (textlines
のコードは、ここで境界線に関する質問に関して提供された解決策から取られています)私はそれをかなり理解していますが、私の問題に影響するとは思えませんが、間違っている可能性があります。とにかく、ここにある:それはなぜ起こるか私にはわからないが、あなたが追加することによって、その問題のいずれかを避けることができ
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape
android:shape="rectangle">
<stroke android:width="1dp" android:color="#FF000000" />
<solid android:color="#FFDDDDDD" />
</shape>
</item>
<item android:top="1dp" android:bottom="1dp">
<shape
android:shape="rectangle">
<stroke android:width="1dp" android:color="#FFDDDDDD" />
<solid android:color="#00000000" />
</shape>
</item>
</layer-list>
のTextViewにlayout_weight = "1"' を... DanDar3 @ –
はい、1に幅を設定することは何も解決しません。あなたがそれを訂正できると思うなら、質問/回答を編集することを恐れてはいけません。 – Luksprog
すべての列を処理するため*プログラムで* setStretchAllColumns(true)を使用します。 –