zoukankan      html  css  js  c++  java
  • Android中弹出对话框,AlertDialog关键代码

    写在这里便于以后查看。

     Android中弹出对话框的关键代码:

     1 btn01.setOnClickListener(new OnClickListener() {
     2 
     3             @Override
     4             public void onClick(View v) {
     5                 Toast.makeText(musicActivity.this, "tanchu", 100).show();
     6                 // 以下是弹出对话框的关键代码,
     7                 AlertDialog.Builder b = new AlertDialog.Builder(
     8                         musicActivity.this);
     9                 b.setTitle("wyl");
    10                 b.setIcon(R.drawable.icon);
    11                 b.setCancelable(true);
    12                 b.setMessage("这是.setMessage(String str)方法");
    13                 b.setPositiveButton("positivieButton..",
    14                         new DialogInterface.OnClickListener() {
    15 
    16                             @Override
    17                             public void onClick(DialogInterface dialog,
    18                                     int which) {
    19 
    20                                 Toast.makeText(musicActivity.this,
    21                                         "xxxxxxxxxx", 100).show();
    22 
    23                             }
    24                         });
    25                 b.setNegativeButton("否", new DialogInterface.OnClickListener() {
    26 
    27                     @Override
    28                     public void onClick(DialogInterface dialog, int which) {
    29                         // TODO Auto-generated method stub
    30                         Toast.makeText(musicActivity.this, "否...", 100).show();
    31                     }
    32                 });
    33                 b.create().show();
    34             }
    35         });

     

  • 相关阅读:
    修改XCode默认注释并自动生成文档
    百度地图初始化引擎失败
    ios系统分享
    ios判断app是否有打开相机的权限
    mac下https方式连接svn连接不上解决方法
    abbyy ocr sdk
    ant的安装
    ubuntu安装nginx
    ubuntu安装gcc
    iOS保持长时间后台运行
  • 原文地址:https://www.cnblogs.com/Sunnor/p/4844103.html
Copyright © 2011-2022 走看看