0
我注意到了一個TableRow的奇怪事情。作爲LinearLayout的TableRow的奇怪行爲
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="0">
<TableRow
android:background="#9932cc"
android:minHeight="40px"
android:orientation="horizontal">
<LinearLayout
android:paddingLeft="10px"
android:paddingRight="10px"
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:background="@drawable/circle_checkmark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/text1"
android:background="#ffffff"
android:textColor="#161616"
android:text="11111 11111 11111 11111 11111 11111 11111 11111 11111 "
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</TableRow>
</TableLayout>
此代碼無法正常工作,因爲TextView text1不包裹它只是延伸到屏幕之外。我已經設法通過將此LinearLayout嵌入到RelativeLayout中,但它似乎是最不優雅的解決方案,加上我不明白上面的代碼有什麼問題...