Android中自带的对话框及通知栏
来源:互联网 发布:伍华聪开发框架源码 编辑:程序博客网 时间:2024/06/08 00:26
AlertDialog.Builder创建
- 通知对话框
- 列表对话框
- 单选对话框
- 多选对话框
ProgressDialog创建 可以在子线程中刷新
进度对话框
ProgressDialog pd = new ProgressDialog(this);pd.setIcon(android.R.drawable.ic_dialog_alert);pd.setTitle("请稍候");pd.setMessage("正在下载中...");// 修改进度条的样式pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);pd.setMax(100);pd.show(); // 弹出进度对话框时, 默认把进度设置为0
ProgressBar进度条 可以在子线程中控制
<ProgressBar style="@android:style/Widget.ProgressBar.Horizontal" // 改变为长条的样式 android:layout_width="fill_parent" android:layout_height="wrap_content" android:max="100" // 设置进度条的最大刻度 android:progress="0" /> // 设置当前的进度值
Spinner 控件 下拉列表
<Spinner android:id="@+id/spinner" android:entries="@array/lagu" // 指定展示的数据 android:layout_width="fill_parent" android:layout_height="wrap_content" />// 定义在strings.xml文件中<string-array name="lagu"> <item>java</item> <item>.net</item> <item>c#</item> <item>c</item> <item>c++</item> <item>java</item> <item>.net</item> <item>c#</item> <item>c</item> <item>c++</item></string-array>
AutoCompleteTextView 自动提示文本框
<AutoCompleteTextView android:id="@+id/actv" android:completionThreshold="1" // 设置从第一个字符开始提示, 默认值为: 2 android:layout_width="fill_parent" android:layout_height="wrap_content" />AutoCompleteTextView actv = (AutoCompleteTextView) findViewById(R.id.actv);String[] items = {"老方", "老黎", "老冯", "张泽华", "张三", "张冲", "王1", "王昭珽", "王友军", "王友红"};ArrayAdapter<String> mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items);actv.setAdapter(mAdapter);
MultiAutoCompleteTextView 多个自动提示文本框
// 设置一个分隔符号: 逗号mactv.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
Notification 通知
Notification notification = new Notification( R.drawable.about_brand, "您有一条新的消息过来了...", System.currentTimeMillis());// 使用隐式方式指向小芳的聊天页面Intent intent = new Intent("com.ycy.xiaofang");/** * PendingIntent是一个延期意图(在未来的某个时间段, 开启一个页面, 并且可以指定使用的次数) * 其实就是对Intent类的一个包装, 增加了一个使用次数的功能 * * intent 是指向某个页面的意图. 注意: 此意图必须使用隐式的方式. */PendingIntent contentIntent = PendingIntent.getActivity(this, 10, intent, PendingIntent.FLAG_ONE_SHOT);notification.setLatestEventInfo(this, "小芳", // 通知详细内容的标题 "今晚汉庭168旁边的肯德基旁边的...不见不散.", // 通知详细内容的详情信息 contentIntent); // 当点击通知时, 跳转到哪一个页面的PendingIntent// 设置通知的标识// notification.flags = Notification.FLAG_AUTO_CANCEL; // 点击后自动关闭notification.flags = Notification.FLAG_FOREGROUND_SERVICE; // 运行在前台的服务, 类似于手机卫士的通知// 设置弹出通知时需要的场景: 声音, 亮灯, 震动notification.defaults = Notification.DEFAULT_ALL; // 弹出通知时, 播放声音, 亮灯和震动.nm.notify(123, notification);
0 0
- Android中自带的对话框及通知栏
- android系统自带对话框的用法
- Android-系统自带通知栏and自定义通知栏
- android系统自带对话框
- Android弹出对话框--Alertdialog(系统自带的)
- android 带ProgressBar的Notification通知栏
- Android带下载进度条的通知栏
- Android更新带进度条的通知栏
- Android系统中自带的图标
- Android系统中自带的图标
- Android系统中自带的图标
- Android系统中自带的图标
- android中自带的开发模板
- Android系统中自带的图标
- android sdk中自带的json
- Android中自带的list布局
- Android中自带的SQLite数据库
- android之对话框通知栏:
- android http-post方法简单实现
- 开发部经理治乱记_新员工转正演示评语【二】
- Linux下crontab的使用
- 2014 1230
- unity3d eclipse下调用java代码(自己研究出来的,与网上流传的稍有区别)
- Android中自带的对话框及通知栏
- 刺杀金正恩 综合下载地址 讯雷 BT 百度云 什么格式都有
- 安卓中的样式(类似于CSS)
- 在 linux 下使用 CMake 构建应用程序
- Android中图片处理
- hrbust1558 小背包 (01背包)
- windbg分析dump文件
- android学习记录-文件操作
- Looper、Handler和Thread的关系