我有一个问题,我需要在Android布局中放置3个按钮,但是:
我尝试了一些表和堆栈布局的东西,但没有设法让它与宽度一起工作.
请帮我
使用LinearLayout作为根,然后为每个按钮赋予属性android:layout_weight="1"- 这将使它们都具有相同的权重,并占用空间.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dip"
android:orientation="horizontal" >
<Button
android:id="@+id/rvButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<Button
android:id="@+id/rvButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<Button
android:id="@+id/rvButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
/>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1928 次 |
| 最近记录: |