位置: 编程技术 - 正文

android各种控件的事件监听及举例(andriod 控件)

发布时间:2024-02-27

推荐整理分享android各种控件的事件监听及举例(andriod 控件),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:安卓app控件,android常用控件大全,安卓控件属性有哪些,andriod 控件,android常用控件大全,android控件大全及用法,android界面控件,android常用控件大全,内容如对您有帮助,希望把文章链接给更多的朋友!

原帖地址: version="1.0" encoding="utf-8"?><menu xmlns:android=" <item android:id="@&#;id/apple" android:title="苹果" /> <item android:id="@&#;id/banana" android:title="香蕉" /> <item android:id="@&#;id/exit" android:title="退出" /></menu>第六个例子:对话框的事件处理package org.hualang.dialog;import android.app.Activity;import android.app.AlertDialog;import android.app.Dialog;import android.app.ProgressDialog;import android.content.DialogInterface;import android.content.DialogInterface.OnClickListener;import android.os.Bundle;import android.view.LayoutInflater;import android.view.View;public class MainActivity extends Activity { /** Called when the activity is first created. */ ProgressDialog myDialog; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Dialog dialog = new AlertDialog.Builder(MainActivity.this) .setTitle("登录提示") .setMessage("这里需要登录") .setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub LayoutInflater factory = LayoutInflater.from(MainActivity.this); final View DialogView = factory.inflate(R.layout.dialog, null); AlertDialog dlg = new AlertDialog.Builder(MainActivity.this) .setTitle("登录框") .setView(DialogView) .setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { // TODO Auto-generated method stub myDialog = ProgressDialog.show(MainActivity.this, "请等待...", "正在为你登录", true); new Thread() { public void run() { try { sleep(); }catch(Exception e) { e.printStackTrace(); }finally { myDialog.dismiss(); } } }.start(); } }).setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub MainActivity.this.finish(); } }).create(); dlg.show(); } }).setNeutralButton("退出", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub MainActivity.this.finish(); } }).create(); dialog.show(); }}xml文件<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android=" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@&#;id/username" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="dip" android:layout_marginRight="dip" android:text="账号" android:gravity="left" android:textAppearance="?android:attr/textAppearanceMedium" /> <EditText android:id="@&#;id/myusername" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_marginLeft="dip" android:layout_marginRight="dip" android:scrollHorizontally="true" android:autoText="false" android:capitalize="none" android:gravity="fill_horizontal" android:textAppearance="?android:attr/textAppearanceMedium" /> <TextView android:id="@&#;id/password" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="dip" android:layout_marginRight="dip" android:text="密码" android:gravity="left" android:textAppearance="?android:attr/textAppearanceMedium" /> <EditText android:id="@&#;id/mypassword" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="dip" android:layout_marginRight="dip" android:scrollHorizontally="true" android:autoText="false" android:capitalize="none" android:gravity="fill_horizontal" android:password="true" /></LinearLayout>

android各种控件的事件监听及举例(andriod 控件)

学习android之Service 学习android之Service综述Service是android系统中的一种组件,它跟Activity的级别差不多,但是他不能自己运行,只能后台运行,并且可以和其他组件进行交互

Android学习之BroadcastReceiver总结 Android学习之BroadcastReceiver总结代码下载:

android学习之选择媒体库中的图片 从媒体库中选择图片主要是启动系统相关ActivityIntenti=newIntent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI;startActivityForResult(i,RESULT_LOAD_IM

标签: andriod 控件

本文链接地址:https://www.jiuchutong.com/biancheng/368653.html 转载请保留说明!

上一篇:Android 开发笔记之界面开发(android 开发 教程)

下一篇:学习android之Service(android secure)

  • 汇算清缴涉及哪些调整
  • 工会经费应该怎么做账
  • 劳务报酬和工资薪金哪个税率高
  • 合并报表调整分录理解
  • 收了押金不退
  • 劳动生产总值和总产值是一回事吗
  • 取得虚开发票所得税分录如何处理?
  • 社保如何会计处理
  • 出口报关单上的运费和保费和实际不一致
  • 厂家给经销商的搭赠政策
  • 房地产母公司将其土地变更到其全资子公司
  • 无形资产评估增值
  • 税收编码选错了,发票已经开出去几个月了,还有影响吗
  • 个体户可以申请公章吗
  • 金税盘发票显示不出确认
  • 分支机构注销留抵税额可以税前扣除吗?
  • 去税局代开开专用发票需要带什么证件?
  • 房屋租赁公司和公寓管理公司区别是什么
  • 稽查补交的税款怎么处理
  • 360安全路由器怎么重启
  • 福利费发票已认证怎么查
  • 完税凭证遗失后怎么处理
  • 企业所得税的概述
  • windows7使用方法
  • java 调用go
  • 累计盈余科目怎么填
  • 固定资产捐赠的账务处理
  • 简单html代码
  • vue中使用jsx语法
  • nodejs安装及环境配置vue
  • return函数
  • squid 启动命令
  • 代发工资的会计科目
  • ps使用背景橡皮擦的时候需要按住什么键
  • 银行承兑是什么意思
  • 上月增值税报表还可以更正吗
  • 人力资源公司的税率是多少
  • 新手搭建一个织布机
  • mysql的简单操作
  • 受让应收账款的账务处理
  • 一般纳税人差额纳税
  • 折旧率多少正常
  • 外币交易的会计分录怎么写
  • 工程附加税税率
  • 个体户怎么申请电子营业执照
  • 建筑企业预缴所得税税率是多少
  • 商品流通企业税费按征收对象可分为
  • 门市装修费用会计处理
  • 以产品偿还债务怎么算
  • 法院拍卖得来的物品有发票吗
  • 盈余公积的例子
  • 固定资产清理的借贷方向
  • 冲红的发票抵扣联要放在凭证里吗
  • 企业注销以后
  • mysql数据库里面有一个表查的特别慢
  • win2003出现各种硬件故障问题时的处理方法
  • ubuntuone
  • Mac Chrome打开HTTPS证书错误问题解决方法
  • centos 6.6安装教程
  • msng.exe病毒
  • win10缺少文件如何修复
  • linux的free命令详解
  • win8怎样设置禁止弹出广告
  • win7打开文件提示用户没有访问权限怎么办
  • cocos2dx ccbreader内存泄露
  • jQuery Mobile 和 Kendo UI 的比较
  • Android开发如何找到TextView指定文本
  • node.js教程详细
  • Node.js中的包管理工具是什么
  • js判断用户输入密码
  • javascript快速入门
  • Android IntentService解析
  • ActivityManagerService (三)
  • 12333医保缴费具体步骤
  • 电子税务局网上实名认证流程
  • 国家税务网上办税服务厅官网
  • 房子办不了产权
  • 温州电子税务局电话号码
  • 税务年报截止日期2022
  • 四川残疾人社保补贴
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号