Android TableLayout 将其宽度从 fill_parent 调整为 wrap_content 本身
我有几个具有layout_width =“fill_parent”的TableLayout,但有时它们似乎会自行切换到layout_width =“wrap_content”,导致整个表格挤压并适合最小宽度。
受影响的表之一是:
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:stretchColumns="*">
<TableRow>
<Button
android:id="@+id/btn1"
android:layout_height="fill_parent"
android:text="@string/btn1"
android:drawableRight="@android:drawable/ic_input_get"
/>
<Button
android:id="@+id/btn2"
android:layout_height="fill_parent"
android:text="@string/btn2"
android:drawableRight="@android:drawable/ic_lock_silent_mode_off"
/>
</TableRow>
</TableLayout>
如您所见,非常标准的东西。它一开始看起来是正确的,但如果我离开活动并返回,切换似乎是随机发生的。有什么建议吗?
I have several TableLayout's that have layout_width="fill_parent" but sometimes they seem to switch to layout_width="wrap_content" on their own, causing the entire table to squeeze and fit in minimum width.
One of the affected tables is:
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:stretchColumns="*">
<TableRow>
<Button
android:id="@+id/btn1"
android:layout_height="fill_parent"
android:text="@string/btn1"
android:drawableRight="@android:drawable/ic_input_get"
/>
<Button
android:id="@+id/btn2"
android:layout_height="fill_parent"
android:text="@string/btn2"
android:drawableRight="@android:drawable/ic_lock_silent_mode_off"
/>
</TableRow>
</TableLayout>
As you can see, pretty standard stuff. It starts off looking right, but if I navigate away from the Activity and come back, the switch seems to happen randomly. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用以下属性:
要了解更多信息,请检查 此链接。
Use the following properties:
To know more, check this link.