1

なんらかの理由で問題が発生しています...「名前」が付いた列は、それほど多くのスペースを占めるべきではありません。列はテキストを折り返しません。以下のセットアップは私が使用していたものであり、以前は機能していました。私は何が欠けていますか?Eclipseに何か問題がありますか?

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fadingEdgeLength="100dp">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#333333"
android:stretchColumns="*">
<TableRow android:layout_margin="1dp" android:background="#333333" android:gravity="center">
<TextView
android:gravity="center"
android:padding="3dip"
android:text="Friends"
android:textColor="#000000"
android:textSize="22dp" />
</TableRow>
<TableRow android:layout_margin="1dp" android:background="#000000">
<TextView
android:gravity="left"
android:padding="3dip"
android:text="Name"
android:textColor="#ffffff"
android:textSize="15dp" />
<TextView
android:gravity="left"
android:padding="3dip"
android:text="Address"
android:textColor="#66cccc"
android:textSize="15dp" />
<TextView
android:gravity="left"
android:padding="3dip"
android:text="Interests"
android:textColor="#006666"
android:textSize="15dp" />
</TableRow> 
<TableRow android:layout_margin="1dp" android:background="#000000">
<TextView
android:gravity="left"
android:padding="3dip"
android:text="This is short"
android:textColor="#ffffff"
android:textSize="13dp"
android:width="0dip"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
<TextView
android:gravity="left"
android:padding="3dip"
android:text="This is some text that might be too long and might need to wrap to the next line."
android:textColor="#cc0033"
android:textSize="13dp"
android:width="0dip"
android:layout_height="match_parent"
android:background="#222222" />
<TextView
android:gravity="left"
android:padding="3dip"
android:text="This is some text that will be long so it needs to wrap and go to the next line blah blah blah."
android:textColor="#99cc00"
android:textSize="13dp"
android:width="0dip"
android:layout_height="match_parent" />
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>
4

1 に答える 1

0

ドキュメントから:

TableRowの子は、XMLファイルでlayout_width属性とlayout_height属性を指定する必要はありません。TableRowは、これらの値を常にそれぞれMATCH_PARENTとWRAP_CONTENTに強制します。

それはいくつかの問題を引き起こしているかもしれませんが、その言葉遣いはとにかくあなたの設定を無視してそれらを上書きするべきだと私に示唆しています。それでも、あなたとあなたの属性を取り除き、それが役立つかどうかを確認する価値があるかもしれlayout_widthませlayout_heightん。TextViewsTableRows

アップデート:

stretchColumnsに設定したことに気づきました*。に変更し1,2ます。

于 2011-12-07T00:26:09.790 に答える