demo15 AlertDialog
Dialog dialog = new AlertDialog.Builder(this).setTitle("对话框").setMessage("this is msg info").setIcon(R.drawable.ic_launcher).create();
dialog.show();
package com.example.demo15alertdialog; import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button; public class MainActivity extends Activity {
private Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); this.button=(Button)super.findViewById(R.id._btn); this.button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Dialog dialog = new AlertDialog.Builder(MainActivity.this).setTitle("对话框")
.setMessage("this is msg info")
.setIcon(R.drawable.ic_launcher)
.setPositiveButton("Delete",new DialogInterface.OnClickListener(){public void onClick(DialogInterface dialogInterface,int whichButton) {
}})
.setNeutralButton("Show Detail",new DialogInterface.OnClickListener(){public void onClick(DialogInterface dialogInterface,int whichButton) {
}})
.setNegativeButton("Cancel",new DialogInterface.OnClickListener(){public void onClick(DialogInterface dialogInterface,int whichButton) {
}})
.create();
dialog.show();
}
});
} @Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
} }
demo15 AlertDialog的更多相关文章
- Stack Overflow 排错翻译 - Closing AlertDialog.Builder in Android -Android环境中关闭AlertDialog.Builder
Stack Overflow 排错翻译 - Closing AlertDialog.Builder in Android -Android环境中关闭AlertDialog.Builder 转自:ht ...
- Android中的AlertDialog使用示例五(自定义对话框)
在Android开发中,我们经常会需要在Android界面上弹出一些对话框,比如询问用户或者让用户选择.这些功能我们叫它Android Dialog对话框,AlertDialog实现方法为建造者模式. ...
- android 弹出AlertDialog的学习案例
我在编写的时候,测试的关键代码: AlertDialog.Builder builder=new AlertDialog.Builder(MainPointListActivity.this); bu ...
- The method setPositiveButton(int, DialogInterface.OnClickListener) in the type AlertDialog.Builder is not applicable for the arguments
The method setPositiveButton(int, DialogInterface.OnClickListener) in the type AlertDialog.Builder i ...
- setView的AlertDialog在受到二次点击后出错
错误报告: 10-21 13:11:16.009: E/AndroidRuntime(27937): FATAL EXCEPTION: main10-21 13:11:16.009: E/Androi ...
- 关于AlertDialog.Builder(Context context)中所应传入的context
错误报告: 10-20 14:34:46.565: E/AndroidRuntime(23098): FATAL EXCEPTION: main10-20 14:34:46.565: E/Androi ...
- 安卓 自定义AlertDialog对话框(加载提示框)
AlertDialog有以下六种使用方法: 一.简单的AlertDialog(只显示一段简单的信息) 二.带按钮的AlertDialog(显示提示信息,让用户操作) 三.类似ListView的Aler ...
- Android AlertDialog去除黑边白边自定义布局(转)
LayoutInflater inflater = this.getLayoutInflater(); View view = inflater.inflate(R.layout.test_alert ...
- Android开发2:事件处理及实现简单的对话框(Toast,AlertDialog,Snackbar,TextInputLayout的使用)
前言 啦啦啦~又要和大家一起学习Android开发啦,博主心里好激动哒~ 在上篇博文中,我们通过线性布局和基础组件的使用,完成了一个简单的学生课外体育积分电子认证系统的界面,本篇博文,将和大家一起熟悉 ...
随机推荐
- c语言学习上的思考与心得
由于这段时间在c语言的学习中,表现的很努力并且完成作业态度认真,所以得到了老师奖励的小黄衫. 以下是我对于c语言的学习感受与心得. 学习感受与心得 我选择计算机的这个专业,是因为我对计算机的学习很有兴 ...
- Redis-秒杀场景应用
Redis Util实现 package test.jedis; import java.util.List; import java.util.Set; import redis.clients.j ...
- 【Android测试】【第三节】ADB——源码浅谈
◆版权声明:本文出自carter_dream的博客,转载必须注明出处. 转载请注明出处:http://www.cnblogs.com/by-dream/p/4651724.html 前言 由于本人精力 ...
- 三星的中低端机使用AsyncTask的问题
三星的中低端机上在子线程中使用AsyncTask会报 01-15 23:46:20.165: W/dalvikvm(7259): Exception Ljava/lang/RuntimeExcepti ...
- JQuery中国省市区无刷新三级联动查询
之前有写过用<Ajax控件来实现中国的省市区无刷新查询> 今天用JQuery来实现,用Ajax控件和JQuery的优缺点就先不说了. 效果图如下: 下面来结合代码来详细说明一下如何用JQu ...
- Android开发笔记:SQLite导入导出数据
SQLite是Android中最方便使用的数据库了,现在看下如何快速的在SQLite中导入导出数据. 首先由于是.NET项目转Android,原有数据库使用的是SQLSERVER,由于项目相同部分结构 ...
- Intersecting Lines---poj1269(求两直线的位置关系)
题目链接:http://poj.org/problem?id=1269 题意:给你两条直线上的任意不同的两点,然后求两条直线的位置关系,如果相交于一点输出该点坐标; #include<iostr ...
- SQL2000的Enterprise Edition和Developer Edition有什么区别
1.SQL Server 2000 Enterprise Edition(企业版) 该版本具有强大的可伸缩性和可靠性,可作为大型WEB站点.企业联机事务处理(OLTP)以及数据仓库系统等数据库产品的服 ...
- HTML5所有标签汇总按功能
基础 格式 表单 框架 图像 音频/视频 链接 列表 表格 样式/节 元信息 编程1. 基础(9个)<!DOCTYPE><html><title><body& ...
- 微信支付开发(3) JS API支付
由于微信支付接口更新,本文档已过期,请查看新版微信支付教程.地址 http://www.cnblogs.com/txw1958/category/624506.html 本文介绍如何使用JS API支 ...