6、AndroidUI组件使用

1.TextView文本标签
作用:显示文本内容;很少使用交互
ClickListener:单击
2.EditText
Android页面内容输入
设置输入类型:文本,数字,日期
<EditText
Android:id="@+id/et_test1_number"
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:hint=’“请输入手机号”
Android:inputType=“phone”>

3.button普通按钮
Android:id="@+id/btu"
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:text=“按钮”

4.ImageView:图片视图
显示图片(HTML img)
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:src="@drawable/ic_launcher_forground"//设置前景图片
android:background_height="@drawable/ic_launcher_background"//设置背景图片

5.CheckBox多选框
页面多选按钮,:题选择;爱好。多个选项使用。
//判断当前是否勾选
Boolean isChecked()
//设置CheckBox 是否勾选
void setChecked(boolean checked)
//设置选中状态改变的监听
void setOnCheckedChangeListener(OnCheckChangeLister listener)

6.RadlioButton单选按钮
必须放到一个按钮组当中。

菜单component
关于menu的3个问题
7.optionmenu
optionmenu在点击手机的menu键触发
activity:onCreateOptionsMenu(Menu menu)
添加menuItem 的两种方式:
纯编码方式:menu.add(…)
加载menu文件的方式:
MenuInflater menuInflater=getMenuInflater();
menuInfater.inflate(R.menu.main_option,menu);
Activity:onOptionsItemSelected(Menuitem item)
当选择某个菜单项的回调方法

8.ContexMenu:上下文菜单
View:setOnCreateContextMenuListener(listener)
为某个视图添加创建ContextMenu的监听(需要长按触发)
Activity:onCreateContextMenu(menu,view,menuInfo)
显示菜单的回调方法
Activity:onContexItemSelected(MenuItem item)
当选择某个菜单项的回调方
Activty:.registerForContexMenu()将上下文菜单注册到某个组件上

9.PopMenu弹出菜单

10.进度条progressbar
进度条:下载时候,播放视频
分类:精确进度条,带进度
不精确进度条:圆圈‘文件加载;视频加载时。
Android:max:进度条最大值
Android:progress:进度条已完成进度值
Android:progressdrawable:设置轨道对应的drawable对象
Android:indeterminate:如果设置true,则进度条不精确显示进度
Android:indeterminateDrawable:设置不显示进度的进度条的drawable对象
Android:indeterminateDuration:设置不精确显示进度的持续时间

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值