阅读更多

http://www.3geye.net/bbs/thread-614-1-1.html

 

这回我们来研究下Android的Dialog的用法。看看难不难用。
跟J2ME 的Alert比起来谁的更容易上手。Let‘s Go。

package com.gggeye.android;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;

/**
 * 对话框的例子
 *
 * 
 *
 * 创建日期 2007-11-15
 * @author wuhua
 *

MSN gggeye@hotmail.com
 *

EMAIL gooogledev@gmail.com


 *

网站支持 http://www.3geye.net


 *

网站论坛 http://www.3geye.net/bbs


 *

wuhua的博客 http://wuhua.3geye.net


 */
 
public class DialogDemo extends Activity {
       @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        this.setContentView(R.layout.main);
         new AlertDialog.Builder(this)
         .setIcon(R.drawable.icon)
         .setTitle("对话框")
         .setPositiveButton("确定", new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int whichButton) {
                
                
             }
         }).show();
       
//        AlertDialog.show(this, "This Dialog Demo",
//                R.drawable.icon, "That's a file, not a directory", "Cancel", false);
    }
}

上面就是一个简单的Dialog的例子,
如果想知道高级的一些用法,可以查看AlertDialog的API相关文档

更多相关文章

  1. android踩坑日记
  2. android弹出对话框
  3. android dialog
  4. Android]仿通讯录ListView小例子
  5. 《Android面试宝典》学习笔记(第四章:对话框、信息提示和菜单)
  6. 地图入门(一):Android上使用Google Maps加标注的最最简单的例子
  7. Android学习笔记(33):Android对话框
  8. Android中am命令用法详解
  9. Android列表控件Spinner简单用法示例

随机推荐

  1. Android(安卓)启动过程
  2. 我的android 第20天 - 自定义适配器
  3. android am命令用法
  4. android程序在Layout中设置控件水平或垂
  5. Android错误解决方法大集合
  6. 用android-logging-log4j去实现log输出内
  7. Android之使用传感器获取相应数据
  8. Eclipse For Android(安卓)代码自动提示
  9. Android通过onDraw实现在View中绘图操作
  10. android5中数据存储方式详解