无法更改Eclipse中的按钮宽度(android)
问题描述:
请查看下面的Button12s。它只是一个带有文字“GO”的按钮,但按钮很宽。我希望它和文本一样宽。
如果有问题,它嵌套在表格中。无法更改Eclipse中的按钮宽度(android)
<TableRow
android:id="@+id/TableRow1_1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<CheckBox
android:id="@+id/CheckBox25"
android:layout_width="fill_parent"
android:layout_height="25dp"
android:text="@string/_3x12s" />
<Button
android:id="@+id/Button12s"
android:minHeight="1dp"
android:minWidth="1dp"
android:onClick="starttimer"
android:text="@string/_GO" />
链接图像(我不能嵌入尚未):http://i.stack.imgur.com/nvFl7.png
答
的android:minWidth = “1DP” 将导致它填补行。
采用Android:layout_width = “WRAP_CONTENT”,使其围绕这个词紧密地配合。
像这样的布局可能是你想要
<TableRow
android:id="@+id/TableRow1_1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1"
>
<CheckBox
android:id="@+id/CheckBox25"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:text="3x12s" />
<Button
android:id="@+id/Button12s"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:paddingLeft="10dp"
android:layout_marginLeft="10dp"
android:paddingRight="10dp"
android:layout_marginRight="10dp"
android:onClick="starttimer"
android:background="@color/grey"
android:text="GO" />
</LinearLayout>
<CheckBox
android:id="@+id/CheckBox30"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="25dp"
android:text="5reps" />
</TableRow>
什么,但我会建议让您的行比您在样本中显示25dp更大,因为这是一个硬按钮按下。
没有变化。 [图像](http://oi40.tinypic.com/15hy83n.jpg)“' – eibwen 2013-05-03 01:17:19
奇怪的是,我只是在我的xml文件上做了同样的工作。我将不得不更多地使用它。 – HalR 2013-05-03 01:22:13
如果你在意,这里是整个文件,也许有一些我错过了。 [链接](https://docs.google.com/document/d/1lyTl-NPskPKjjYDZeCFl6gkTjClh213xdQzFlLaEy18/edit?usp=sharing) – eibwen 2013-05-03 01:25:47