读书人

原来说错了:右侧两个按钮并排靠右左

发布时间: 2013-10-18 20:53:13 作者: rapoo

原来说错了:右边两个按钮并排靠右,左边一个按钮填满其他空间,有代码和图片



我要的是左边的按钮只是占用当前行的剩余空间
要怎么写呢?


[解决办法]
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<LinearLayout
android:id="@+id/right"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_marginLeft="1dp"
android:orientation="horizontal" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="btn1" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="btn2" />
</LinearLayout>

<Button


android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/right"
android:text="godbtn"
/>
</RelativeLayout>

原来说错了:右侧两个按钮并排靠右,左边一个按钮填满其他空间,有代码和图片

读书人网 >Android

热点推荐