Android学习杂记(二)布局
2014-08-30 21:53
399 查看
线性布局和相对布局的一些性质
android:id="@+id/my_button" +指R文件,可以不要 @是指解析器RelativeLayout是LinearLayout的子类
ViewGroup.LayoutParam 确定了子视图的高和宽(layout_height,layout_width)
android:layout_height 和 android:width 的属性值有三个:fill_parent, match_parent 和 wrap_content
fill_parent 从Android 2.2开始就用 match_parent 代替了,恰好包括父控件。wrap_content 恰好能包括子控件.
density-independent pixel units (dp)
getRight() = getLeft() + getWidth()
getBottom() = getTop() + getHeight()
android:padding是里面的内容和父View边界之间的距离 ;android:layout_margin 则是说两个子view边界之间的距离
当超出屏幕后,getMeasuredHeight()等于getHeight()加上屏幕之外没有显示的大小。就是说MeasureHeight是实际设置大小,Height是实际显示大小
Adapter是Data和View之间的桥梁,man in the middle, 有点像Intent,你定义listView要setAdapter,把数据传进来
LinearLayout有oritentation属性,他的子视图都是放在栈里的
android:weight属性很有意思,表示此控件在LinearLayout中的权重
RelativeLayout比LinearLayout性能好,因为不用嵌套
android:margin和android:padding,前者表示距离父视图的距离,后者表示控件内部的距离。
链接:
谷歌官方文档 layout标签 http://developer.android.com/guide/topics/resources/layout-resource.html谷歌官方文档 layout入门 http://developer.android.com/guide/topics/ui/declaring-layout.html
安卓布局大全 包括五种经典布局 http://www.cnblogs.com/devinzhang/archive/2012/01/19/2327535.html
相关文章推荐
- 学习杂记:android布局 LinearLayout
- Android 学习笔记 (3)界面布局
- Android UI学习 - FrameLayou和布局优化 推荐
- Android UI学习 - FrameLayou和布局优化
- Android UI学习 - FrameLayou和布局优化
- 转载 Android入门学习_代码常用布局
- 从简单的android 登陆应用 ,学习布局,
- 【android基础学习之八】——页面布局
- Android周学习Step By Step(4)--界面布局
- Android布局学习——线性布局和相对布局混合使用
- Android UI学习 - FrameLayou和布局优化
- 学习android之布局
- Android UI学习 - FrameLayou和布局优化
- android布局初步学习
- android 学习8—— Activity布局初步(一)
- 传智播客学习之Android-界面布局
- Android用户界面设计——关于布局的学习笔记
- 快乐分享Android学习心得---模型学习方探究App布局学习
- [无线] Android 系统开发学习杂记
- Android学习系列(5)--App布局初探之简单模型