LinearLayout:线性布局的控件,要么横向排布要么纵向排布
无论是哪种排布,都由android:orientation来控制,其中vertical是横向,Horizaontal是纵向
常用的属性:
android:gravity————设置的是控件自身上面的内容位置

android:layout_gravity—–设置控件本身相对于父控件的显示位置

android:layout_weight—– 给控件分配剩余空间

代码举例:"http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:id="@+id/activity_main"    android:layout_width="match_parent"//宽度填满整个空间    android:layout_height="match_parent"空间//高度填满    android:baselineAligned="false"    android:orientation="vertical">//横向排布    

顺便清楚一下其中的fill_parent,wrap_content和match_parent之间的区别
1)fill_parent是设置一个顶部布局或控件强制性让它布满整个屏幕
2)wrap_content布局指根据视图内部内容自动扩展以适应其大小。
3)match_parent和fill_parent的用法一样

代码举例:wrap_content:<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:id="@+id/activity_main"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:baselineAligned="false"    android:orientation="vertical">    <Botton    android:id="@+id/btnButton1"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:text="Button CJP"/> RelativeLayout>

更多相关文章

  1. 说说 Android(安卓)的常见 UI 控件
  2. Android(安卓)常用UI控件的一些属性设置(在.xml文件里进行的设置
  3. Android控件布局常用属性
  4. Android(安卓)控件布局常用属性
  5. 布局指令大全
  6. Android(安卓)RelativeLayout 属性
  7. Android(安卓)相对布局 RelativeLayout 属性
  8. Android动态生成控件居中显示
  9. Android--动态添加控件

随机推荐

  1. Android消息处理机制之Handler
  2. Android中定时执行任务的3种实现方法
  3. Android 怎么样使用shape
  4. 【Android】TextView的文字长度测量及各
  5. Android(安卓)- proguard混淆器出错
  6. Android Handler机制详解:在线程中新建Han
  7. android中刷新Invalidate和postInvalidat
  8. 《第一行代码:Android(第2版)》,作者郭霖
  9. 解决eclipse里android无法关联源码办法
  10. Android屏幕完美适配最全攻略(最权威的官