1.回顾

   上篇 掌握了 单选框RadioGroup 和复选框CheckBox

2.知识点

   五大布局:

   (1)LinaerLayout

   (2)RelativeLayout 

   (3)FrameLayout 

   (4)AbsoluteLayout 

   (5)TableLayout 

3. 总结


3.1.LinearLayout 线性布局

重要属性:
   父类布局上操作子类布局控件 : android:gravity="right|bottom"
   线性布局排列:          android:orientation="vertical"
  子类控件控制:     android:layout_gravity="center_horizontal"
  子类控件比例:     android:layout_weight="3"
使用layout_weight 的时候,如果子控件的 layout_height为 wrap_content 则为 正比; 
                                              如果子控件的 layout_height为 match_parent 则为 反比; 


3.2.RelativeLayout 相对布局

          相对父类容器的位置:          android:layout_alignParentRight="true"
          相对父类容器的距离:          android:layout_marginLeft="40dp" ; android:layout_margin="40dp"
          相对父类容器居中位置 :      android:layout_centerInParent="true"
    
         位于给定控件的下面:android:layout_below="@+id/tv_one"
         位于给定控件的右边:android:layout_toRightOf="@+id/tv_one"
         位于给定控件的上面: android:layout_above="@+id/tv_one"
         位于给定控件的左面:      android:layout_toLeftOf="@+id/tv_one"
 
         和给定控件的文本在一条线上:android:layout_alignBaseline="@+id/tv_one"
         
     

 3.3.FrameLayout 分层布局(帧布局)

          可以实现 进度条上 出现 文字,layout_gravity="center";
      先添加的布局在 下面;
      使用android:foreground 设置前景图
      使用android:foregroundGravity 设置前景图的位置
      使用android:keepScreenon 设置屏幕唤醒
      
      

 3.4.AbsoluteLayout 绝对布局

    使用android:layout_x="20dp" 和 android:layout_y="20dp" , 两个属性固定位置
    坐标布局:可以直接指定子元素的绝对位置
    缺陷:屏幕适应差,不能适配其他屏幕
    

 3.5.TableLayout 表格布局

    以行列的形式管理子控件,通过 TableRow 代表每一行
    重要属性:
    android:collapseColumns="1,2"
    android:shrinkColumns="1,2"
    android:stretchColumns="1,2"
 

4. 总结

  常用的是LinaerLayout  和     RelativeLayout   ,AbsoluteLayout 几乎不用   ,FrameLayout   和TableLayout 有时使用;                             


更多相关文章

  1. Android_Layout_xml布局
  2. Android(安卓)ListView展示不同的布局
  3. Android(安卓)模仿renren的左右划动菜单栏
  4. RemoteViews用法一:widget简单用法
  5. [置顶] Android中ScrollView用法介绍
  6. ViewPager占用满屏问题解决方法
  7. MonkeyRunner进坑——errors importing other modules
  8. Android(安卓)程式开发:(十一)选择控件 —— 11.1 TimePicker
  9. [置顶] Android(安卓)SimpleAdapter,SimpleCursorAdapter,ArrayAda

随机推荐

  1. Android实现列表时间轴
  2. 执行命令mm出错以及运行adb shell出现ins
  3. Android(安卓)Preference使用
  4. Android源码分析-全面理解Context
  5. Android性能优化典范(五)
  6. android学习笔记(十) android 使用 googl
  7. 浅谈Android(安卓)WebView
  8. Android(安卓)PopupWindow使用,轻松实现微
  9. android 新建工程,没R.java 文件
  10. 【邀您参加】Android大讲堂-Android游戏