我遇到了一些动态生成的按钮问题。如果文字太多,他们会离开屏幕。你可以看到它的图片:Android - 动态按钮关闭屏幕
如果在按钮上的文本是小那么问题不出来,但如果字符数是高的,那么按钮上显示出来的画面。
按钮的布局如下:
<?xml version="1.0" encoding="UTF-8"?>
<Button xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/newGuessButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_alignParentRight="true" >
</Button>
和按钮在表中的布局创建:
<TableLayout android:id="@+id/buttonTableLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" android:stretchColumns="0,1,2">
<TableRow android:id="@+id/tableRow0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"></TableRow>
<TableRow android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"></TableRow>
<TableRow android:id="@+id/tableRow2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"></TableRow>
重要的是要注意,这桌走了进去是很重要的线性布局。
是否有反正我可以将按钮的大小限制为使用它们的屏幕大小?
你必须使用一个表吗?怎么样一个gridview? – AndroidEnthusiast 2014-10-02 10:14:55
我不必使用表格。使用gridview更好吗?它如何帮助解决这个问题? – 2014-10-02 16:45:56