首页 > 其他 > 详细

相对布局(上)

时间:2014-06-27 20:29:14      阅读:422      评论:0      收藏:0      [点我收藏+]

1. 什么是相对布局(RelativeLayout)

2. 为什么要相对布局

3. 相对布局的两组常用属性

 

1. 什么是相对布局(RelativeLayout)

    bubuko.com,布布扣

2. 为什么要相对布局

     安卓布局中嵌套会消耗更多资源!!!

3. 相对布局的两组常用属性

    bubuko.com,布布扣

        bubuko.com,布布扣

       代码如下:

 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 2     xmlns:tools="http://schemas.android.com/tools"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent"
 5     tools:context="first.pack.MainActivity$PlaceholderFragment" >
 6 
 7     <TextView
 8         android:id="@+id/firstView"   //创建id
 9         android:layout_width="wrap_content"
10         android:layout_height="wrap_content"
11         android:background="#FF0000"
12         android:text="hello_world" />
13     
14     <TextView
15         android:layout_width="wrap_content"
16         android:layout_height="wrap_content"
17         android:layout_toRightOf="@+id/firstView"   //根据id判断相对位置
18         android:background="#00FF00"
19         android:text="hello_mirror" />
20 
21 </RelativeLayout>

             bubuko.com,布布扣

相对布局(上),布布扣,bubuko.com

相对布局(上)

原文:http://www.cnblogs.com/iMirror/p/3809639.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!