android手机ui控件,Android UI控件

输入控件是应用程序用户界面中的交互式组件。Android提供了您可以在UI中使用的各种控件,例如按钮,文本字段,搜索栏,复选框,缩放按钮,切换按钮等等。

3259a4301ea2279138fb83d6e06fbded.png

UI元素

甲视图是绘制屏幕,用户可与之交互并一个上的东西的对象的ViewGroup是保持以定义用户界面的布局其它视图(和的ViewGroup)对象的对象。

您可以在XML文件中定义布局,为布局提供可读的结构,类似于HTML。例如,一个简单的垂直布局与文本视图和按钮看起来像这样 -

Android UI控件

Android提供了许多UI控件,允许您为应用程序构建图形用户界面。

没有

UI控件和说明

1TextView

此控件用于向用户显示文本。

2EditText

EditText是预定义的TextView子类,包含丰富的编辑功能。

3

AutoCompleteTextView

AutoCompleteTextView是与EditText类似的视图,除了在用户打字时自动显示完成建议列表。

4

按钮

可以由用户按下或单击的按钮来执行操作。

5

ImageButton

ImageButton是一个AbsoluteLayout,它使您能够指定其子项的确切位置。这显示了一个可以由用户按下或点击的图像(而不是文本)的按钮。

6

复选框

可由用户切换的开/关switch。当用户提供一组不相互排斥的可选择选项时,应使用复选框。

7

ToggleButton

An on/off button with a light indicator.

8

RadioButton

The RadioButton has two states: either checked or unchecked.

9

RadioGroup

A RadioGroup is used to group together one or more RadioButtons.

10

ProgressBar

The ProgressBar view provides visual feedback about some ongoing tasks, such as when you are performing a task in the background.

11

Spinner

A drop-down list that allows users to select one value from a set.

12

TimePicker

The TimePicker view enables users to select a time of the day, in either 24-hour mode or AM/PM mode.

13

DatePicker

The DatePicker view enables users to select a date of the day.

Create UI Controls

Input controls are the interactive components in your app"s user interface. Android provides a wide variety of controls you can use in your UI, such as buttons, text fields, seek bars, check box, zoom buttons, toggle buttons, and many more.

如前一章所述,视图对象可能具有分配给它的唯一ID,它将在树中唯一标识视图。XML标签内的ID的语法是 -

android:id="@+id/text_id"

要创建UI控件/视图/窗口小部件,您必须在布局文件中定义一个视图/小部件,并为其分配一个唯一的ID,如下所示:

然后最终创建一个Control对象的实例并从布局中捕获它,使用以下命令 -

TextViewmyText=(TextView)findViewById(R.id.text_id);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值