TextView——显示文本框控件
TextView控件的常用属性
- android:id——控件的id
- android:layout_width——控件的宽度
- android:layout_hight——控件的高度
- android:text——文本内容
- android:textSize——文本大小
- android:textColor—文本颜色
- android:backgound——控件背景
wrap_content:包裹实际文本内容
match_parent:当前控件铺满父类容器:2.3api之后添加的一个属性值
fill_parent:当前控件铺满父类容器:在2.3api之前的一个属性值
2.EditText——输入文本框
TextView控件的常用属性
- android:id——控件的id
- android:layout_width——控件的宽度
- android:layout_hight——控件的高度
- android:text——文本内容
- android:textSize——文本大小
- android:textColor—文本颜色
- android:backgound——控件背景
- android:hint——提示输入文本
- android:inputType—文本类型
3.ImageView——显示图片的控件
ImageView属性
- android:src=”@drawable/ic_launcher”——ImageView的图片内容
- android:background=”@drawable/ic_launcher”——ImageView背景图片
- android:background=”#00ff00”——ImageView的RGB颜色
4.Button——按钮
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button"
/>
特征:
- 可以作为一个按钮产生明显的点击事件
- Button有text属性,无src属性,text当中的字符串一般是存放在value当中的string资源
- 产生明显的点击效果
- 和smallButton一样,只不过smallButton多一条style属性, style=”?android:attr/buttonStyleSmall”,它调用了系统下面的一个风格
5.ImageButton——图片按钮
<ImageButton
android:id="@+id/imagebutton1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawablebc_ab_share_pack_holo_light"
/>
特征:
- 可以作为一个按钮产生明显的点击事件
- ImageButton有src属性,无text属性,不可以设置文本内容,background以及src添加一个image,当前图片上可以做一个有文本内容的图片
- 产生明显的点击效果