布局(控件)---用来存放控件,并控制他们的位置排列


inearLayout---线性布局--控件安书序排成一行或者一列

属性:

android:layout_width=""---布局宽

android:layout_height=::---布局高

android:orientation=""---设定布局中的控件的排列方式---水平或者垂直


RelativeLayout---相对布局---控件依靠与父容器/同一容器中的其他控件的相对位置显示排列

属性:

android:layout_width=""---布局宽

android:layout_height=""---布局高

android:orientation=""---本人认为没有意义


TableLayout---表格布局---通过TableRow来定义一行---其中的元素通常不需要指定宽、高

属性:

android:layout_width=""---布局宽

android:layout_height=""---布局高

android:stretchColums=""---要拉伸的列


FrameLayout---框架布局---默认出现在左上角

属性:

<merge xmlns:android="http://schemas.android.com/apk/res/android">

</merge>

如果你的布局xml文件是以FrameLayout为布局,可以省略,直接写成上面的形式,优化布局,系统默认底层就是FrameLayout

把布局加载到Activity中

LayoutInflater inflater=LayoutInflater.from(Context context);

inflater.inflate(int resource,ViewGroup root);-----参数 R.layout.main null


把控件加载到Activity中

View findViewById(int id);





更多相关文章

  1. Android 命名空间和自定义属性
  2. android之ListView的item布局问题总结
  3. Android中ExpandableListView控件基本使用
  4. android 神奇的android:clipChildren属性

随机推荐

  1. 如何加密android apk
  2. Android之ScrollBar
  3. Android(安卓)-- 内容观察者
  4. Android系统介绍
  5. Android中Intent传递对象的两种方法(Seri
  6. 【Android】小白进阶之接口和抽象类的使
  7. 获取Android开机启动项列表
  8. Retrofit使用总结
  9. Android中文API(99)—— RelativeLayout
  10. Android中IntentService的使用及其源码解