首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

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

2013-10-18 
原来说错了:右边两个按钮并排靠右,左边一个按钮填满其他空间,有代码和图片我要的是左边的按钮只是占用当前

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



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


[解决办法]
<?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>

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

热点排行