Java 如何在Android中更改表格行高度?
我想在我的应用程序中自定义TableRow-更改它的高度,以便我可以在其中放置两行按钮。我无法在UI设计器中实现它。所以问题是——我如何用XML或Java代码编写这个程序 不完全确定您想要什么,但以下是如何在一个Java 如何在Android中更改表格行高度?,java,android,tablerow,android-tablelayout,Java,Android,Tablerow,Android Tablelayout,我想在我的应用程序中自定义TableRow-更改它的高度,以便我可以在其中放置两行按钮。我无法在UI设计器中实现它。所以问题是——我如何用XML或Java代码编写这个程序 不完全确定您想要什么,但以下是如何在一个表格行中获得按钮的“行”。做一些类似的事情,看看这是否就是你所说的 我在表格行中添加了一个线性布局,即垂直方向,然后在另一个线性布局中包装按钮,即水平方向 <TableRow> <LinearLayout android:id="@+
表格行中获得按钮的“行”。做一些类似的事情,看看这是否就是你所说的
我在表格行中添加了一个线性布局
,即垂直方向
,然后在另一个线性布局
中包装按钮
,即水平方向
<TableRow>
<LinearLayout
android:id="@+id/layout3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/layout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/button1"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="ABCDE" />
<Button
android:id="@+id/button2"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="A" />
<Button
android:id="@+id/button3"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="ABC" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/button1"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="ABCDE" />
<Button
android:id="@+id/button2"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="A" />
<Button
android:id="@+id/button3"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="ABC" />
</LinearLayout>
</LinearLayout>
</TableRow>