Android学习:不再提示对话框(创建自定义对话框)
来源:互联网 发布:c语言定义变量 编辑:程序博客网 时间:2024/06/05 20:47
界面:
创建自定义对话框首先应该定义对话框界面,我只是想要一个带有复选框的对话框界面,因此布局文件很简单:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <CheckBox android:id="@+id/nomore" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="不再提示" /></LinearLayout>接下来在应用程序中调用AlertDialog.Builder的setView(View view)方法让对话框显示该自定义界面即可。
final Builder builder=new AlertDialog.Builder(this);builder.setTitle("涉及系统权限,请您手动删除相应图片");LinearLayout linearLayout=(LinearLayout)getLayoutInflater().inflate(R.layout.nomore, null);builder.setView(linearLayout);builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {public void onClick(DialogInterface dialog, int which) {......}});builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {public void onClick(DialogInterface dialog, int which) {}});builder.create().show();}});
功能实现:将复选框的选择情况存储在SharedPreferences中,下次根据SharedPreferences中存储值判断是否弹出对话框。
- Android学习:不再提示对话框(创建自定义对话框)
- android创建自定义对话框
- Android 对话框(三)自定义对话框
- 创建提示对话框
- Android-Dialog对话框 全解(普通对话框,单选对话框,多选对话框,列表对话框,自定义对话框,Activity对话框)
- Android开发中如何创建自定义对话框
- android 创建一个简单的自定义对话框
- android中的对话框:自定义对话框
- 创建自定义对话框
- android基础学习(6)-------AlertDialog.Builder提示对话框
- Android 对话框进阶(自定义)
- android自定义对话框(AlertDialog)
- WindowsMobile创建自定义对话框(多选项对话框)
- app选择不再提醒,对话框将不再提示
- android自定义透明对话框,透明提示框,自定义Dialog
- Android 提示对话框
- Android简单对话框、输入对话框、单选对话框、复选对话框、列表对话框、自定义对话框、时间对话框
- android学习笔记33:自定义对话框
- 入门级ARM汇编指令
- UI设计准则
- 指针的一些看法
- 在UITableView中动态的插入或删除行(或者节)
- 时间类
- Android学习:不再提示对话框(创建自定义对话框)
- 过滤html
- 解决MySQL出现UnauthenticatedUser的问题
- 关于《C语言深度剖析》之编译器的bug问题
- js获取项目根路径
- php中session过期时间设置
- list 转换 map
- 单独hibernate 生成表
- MAP数组