`
007007jing
  • 浏览: 41263 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

android2.3 api demo 学习系列(18)--App/Dialog

阅读更多

今天主要学习Dialog:

1、一般的dialog

 

AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure you want to exit?")
       .setCancelable(false)
       .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int id) {
                MyActivity.this.finish();
           }
       })
       .setNegativeButton("No", new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int id) {
                dialog.cancel();
           }
       });
AlertDialog alert = builder.create();

 效果图

 2、list选择框:

 

final CharSequence[] items = {"Red", "Green", "Blue"};

AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Pick a color");
builder.setItems(items, new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int item) {
        Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show();
    }
});
AlertDialog alert = builder.create();

  

公司网络忒不给力了,打不开博客。。。今天就到这吧

 

  • 大小: 3.6 KB
  • 大小: 5 KB
分享到:
评论

相关推荐

    android dialog------普通对话框

    android dialog-------普通对话框

    Android代码-Material Design风格Preference UI

    implementation 'moe.shizuku.preference:preference-dialog-android:' //implementation 'moe.shizuku.preference:preference-dialog-appcompat:' // if you want to use appcompat version dialog //...

    Android代码-AppUpdater版本更新、一键傻瓜式升级App

    AppUpdater for Android 是一个专注于App更新一键傻瓜式集成的开源库,主要包括app-updater和app-dialog。 > 下载更新和弹框提示分开,是因为这本来就是两个逻辑。完全独立开来能有效的解耦。 app-updater 主要负责...

    react-native-android-location-services-dialog-box:React本机Android位置服务对话框

    React Native Android Location Services对话框 从Android位置服务打开对话框的React-Native组件安装大多是自动安装(推荐) yarn add react-native-android-location-services-dialog-box 要么npm install react-...

    Android---UI篇---Dialog(对话框)

    Android---UI篇---Dialog(对话框)

    Element-ui css非网络引用,

    <el-dialog :visible.sync="visible" title="Hello world"> <p>Try Element</p> </el-dialog> </div> <el-button type="primary" icon="el-icon-search">搜索</el-button> <!-- import Vue before Element -...

    Android自定义dialogDemo

    Android自定义dialogDemo

    Android:自定义Dialog-Demo

    Dialog 很经常用到的一个控件,但大多时候系统默认的样式是不满足于项目使用的,故自定义了一套合适的Dialog模板方便日常使用。

    Android代码-LLollipop dialog demo

    A simple to use library to create a android L dialog on any 2.3 android device in your app using 3 Lines of code! How to compile the example Download the zip Extract Import with android studio ...

    Android代码-jmdsp

    You'll need something that handles "org.openintents.action.PICK_FILE" ....Install my app: ...- Tap "Load" text to open an open file dialog. Pick a SMF file. -

    bootstrap3-dialog 基于bootstrap3的弹出层组件

    * Date:2015-04-18 * 说明: * 本js只是在bootstrap3-dialog的基础上进行的2次封装, * bootstrap3-dialog已经是非常好用了,调用也非常简单。 * 详情请访问:https://github.com/nakupanda/bootstrap3-dialog,...

    vue-dialog-drag-可拖动对话框-Vue.js开发

    vue-dialog-drag简单的可拖动对话框演示功能:拖放支持(仅用于拖放,不用于拖放)拖放区域组件“ Pin模式”,以锁定vue-dialog-drag简单的可拖动对话框演示功能:拖放支持(仅用于拖动,不用于放置)放置区域组件...

    API对话框------Win32 DialogBased Application插件的安装

    API对话框------Win32 DialogBased Application插件的安装

    Android代码-Simply Solid

    Material color chooser dialog; Save colors to storage; Round icon support for android 7.1; The app supports 4.1 devices. You can download the latest (3.0.6) signed APK from this repo here: ...

    Android代码-Dialog

    本例中,包含DialogDemo(Dialog/app/)是对话框的演示项目源代码,以及Library库(Dialog/dialog/)是封装的空祖家对话框的源代码。 项目托管的Maven仓库在https://bintray.com/myzchh/maven/dialog 本项目遵循...

    jquery-ui-dialog-demo

    jquery 弹出窗口插件,包含js中的 alert confirm open 等。

    m-dialog:vue的对话框组件

    Dialog Vue 的 Dialog 弹窗组件,包含了 alert 和 confirm 对话框。 参考代码: Use npm install vue-m-dialog import MDialog from 'vue-m-dialog' // ro import { Dialog, Alert, Confirm } from 'vue-m-dialog' ...

    Android---UI篇

    •Android---UI篇---Dialog(对话框) • •Android---UI篇---AutoCompleteTextView(自动提示) • •Android---UI篇---Toast(提示) • •Android---UI篇---Button(按钮) • •Android---UI篇---TextView...

    Android代码-Range-Time-Picker-Dialog

    Simple Android Library that provide you a custom dialog that allow you to set a start time and end time. Screenshot Install Add this to your project build.gradle allprojects { ...

    ng-dialog:基于AngularJS的kiddialog软件实现

    将data/目录复制到 ng-dialog 中的app/data/ 将所有 PHP 序列化数据转换为 json 文档: $ find app/data -name ' .dat' -o -name ' .idx' -o -name '*.ser' | xargs xp -cp contrib/ Serialized2Json 从所有 ...

Global site tag (gtag.js) - Google Analytics