1.TextView控件的常用属性(有些属性没有写出来)
android:id---控件的id
android:layout_width---控件的宽度
android:layout_height---控件的高度
android:text---文本内容
android:textSize---文本大小
android:textColor---文本颜色
android:background--控件背景
2.EditText控件的常用属性
以上的TextView控件的常用属性也有,
android:hint---输入提示文本
android:inputType---输入文本类型
3.layout中width和height中的三个属性值
wrap_content:包裹实际文本内容
match_parent:当前控件铺满父类容器;2.3API之后添加的一个属性值
fill_parent:当前控件铺满父类容器;在2.3API之前的一个属性值
4.ImageView属性:
android:src="" --ImageView的内容图像
android:background="" --背景,可以设置颜色和图片
5.补充
(1)在Eclipse补全代码的快捷键:Alt+/
(2)在MainActivity.java中将布局xml文件引入到activity当中的语句
setContentView(R.layout.main_activity)
(3)显示文字和数字一般不直接设置,一般都是在strings.xml中先设置,如下:
<string name="button_name">登录</string>
然后再在layout下的xml文件的控件中
android:text="@string/button_name"
android:id---控件的id
android:layout_width---控件的宽度
android:layout_height---控件的高度
android:text---文本内容
android:textSize---文本大小
android:textColor---文本颜色
android:background--控件背景
2.EditText控件的常用属性
以上的TextView控件的常用属性也有,
android:hint---输入提示文本
android:inputType---输入文本类型
3.layout中width和height中的三个属性值
wrap_content:包裹实际文本内容
match_parent:当前控件铺满父类容器;2.3API之后添加的一个属性值
fill_parent:当前控件铺满父类容器;在2.3API之前的一个属性值
4.ImageView属性:
android:src="" --ImageView的内容图像
android:background="" --背景,可以设置颜色和图片
5.补充
(1)在Eclipse补全代码的快捷键:Alt+/
(2)在MainActivity.java中将布局xml文件引入到activity当中的语句
setContentView(R.layout.main_activity)
(3)显示文字和数字一般不直接设置,一般都是在strings.xml中先设置,如下:
<string name="button_name">登录</string>
然后再在layout下的xml文件的控件中
android:text="@string/button_name"