常用控件

来源:互联网 发布:centos nginx rtmp 编辑:程序博客网 时间:2024/04/29 07:44

QQ登陆界面截图

上图为手机QQ登陆界面的截图,我们可以看到在上图中,有“<返回”,“添加账号”,“登录”,还有一个QQ企鹅的图片;

其实,这些都是安卓上的常用控件,下面是安卓常用控件的一个列表:

控件名 解释 TextView 文本框,用于显示不可编辑的文本信息 EditText 编辑框,可以编辑内容的文本框 Button 按钮,可以响应用户点击事件的控件 ImageView 图片控件,用于显示图片 ImageButton 图片按钮,可以设置图片信息的按钮

笑
下面是在 安卓工程 res –> layout文件夹下Activity对应的xml布局中写的常用控件的代码:

<TextView        android:id="@+id/textview"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:text="你好" /><EditText        android:id="@+id/edittext"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:hide="输入框" /> <Button        android:id="@+id/button"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="按钮" /><ImageView        android:id="@+id/imageview"        android:layout_width="wrap_content"        android:layout_height="wrap_content" <ImageView        android:id="@+id/imageview"        android:layout_width="wrap_content"        android:layout_height="wrap_content"       android:src="@drawable/abc_btn_radio_to_on_mtrl_015" /><ImageButton        android:id="@+id/imageview"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:src="@drawable/abc_btn_check_to_on_mtrl_000"/>

这些常用控件的属性还有很多,可以一个一个尝试,实践出真理!

这里写图片描述

将程序猿进行到底!

3 0
原创粉丝点击