`
修博龙泉
  • 浏览: 313268 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

android 相对布局RelativeLayout

阅读更多
相对布局:根据所设置的参照控件来进行布局,设置的参考控件可以是父控件也可以是其他子控件
<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:text="中间的按钮,很长很长很长" >
        </Button>

        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_above="@id/button1"      控件的相对位置
            android:layout_alignLeft="@id/button1"
            android:text="上面的按钮" >
        </Button>

        <Button
            android:id="@+id/button3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignRight="@id/button1"
            android:layout_below="@id/button1"
            android:text="下面的按钮" >
        </Button>
    </RelativeLayout>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics