1. 使用系统自带的图标
在布局文件中使用:
2. 布局文件中使用能够自适应不同分辨率的图片背景:
把背景文件重新命名为 xxx.9.png的样式,然后用工具里面的draw9patch编辑图片,通过图片边缘的黑色线条来确定图片如何拉升
3.layout 的属性中pandding 和margin的区别:
padding的定义是: Padding is defined as space between the edges of the view and the view's content. A views size will include it's padding.即padding是view和view之间的空白间距,但是这个空白是属于view的边界内部的。
margin的定义是:Specifies extra space of this view. This space is outside this view's bounds.即margin就是在view的边界外面的空白距离
比如下面一个layout的定义:
android:paddingTop="10.0dip"
android:paddingBottom="30.0dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15.0dip"
android:layout_marginTop="62.0dip"
android:layout_marginRight="15.0dip">
这个Relativelayout的大小包含了paddingTop的10个dip和paddingBottom的30个dip。但是layout大小本身不包含margin
看来padding和margin的主要区别就是padding的填充空白在组件的内部。margin的填充空白在组件的外部。