繁体   English   中英

android表布局超出屏幕

[英]android Tablelayout out of screen

我正在使用tablelayout进行活动。 在开始时,布局很好,但是当一些数据填充活动中的文件时,布局会更改其形式,使其超出屏幕。 如何阻止布局?

您尝试了shrinkColumns选项吗?

<TableLayout
android:shrinkColumns="*"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
...

 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_column="1"> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns="0"> <TableRow android:layout_width="fill_parent" android:layout_height="fill_parent"> </TableRow> <TableRow> <TextView android:layout_width="fill_parent" android:gravity="left" android:text="@string/loc_label" /> <EditText android:id="@+id/editText" android:layout_width="fill_parent" android:layout_column="2" android:gravity="right" /> </TableRow> <TableRow> <TextView android:layout_width="fill_parent" android:padding="3dip" android:text="@string/precipMM" /> <TextView android:id="@+id/precipMM_value_tv" android:layout_width="fill_parent" android:layout_column="2" android:gravity="right" android:padding="3dip" android:text="@string/nodata" /> </TableRow> <TableRow> <TextView android:layout_width="fill_parent" android:padding="3dip" android:text="@string/descrWeather" /> <TextView android:id="@+id/descrTV" android:layout_width="fill_parent" android:layout_column="2" android:gravity="right" android:padding="3dip" android:text="@string/nodata" /> </TableRow> <TableRow> <Button android:id="@+id/buttonConnect" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_column="0" android:text="@string/updateButton" /> <Button android:id="@+id/closeButton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_column="2" android:text="@string/closeButton" /> </TableRow> <TableRow android:layout_width="fill_parent" android:layout_height="fill_parent"></TableRow> <TableRow android:layout_width="fill_parent" android:layout_height="fill_parent"></TableRow> <TableRow android:layout_width="fill_parent" android:layout_height="fill_parent"></TableRow> <TableRow android:layout_width="fill_parent" android:layout_height="fill_parent"></TableRow> <TableRow android:layout_width="fill_parent" android:layout_height="fill_parent"></TableRow> <TableRow android:layout_width="fill_parent" android:layout_height="fill_parent"> </TableRow> </TableLayout> </RelativeLayout> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM