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++线程池的一个实现
原文转自:http://www.cnblogs.com/lidabo/p/3328646.html 略有修改 Cthread类参见:http://www.cnblogs.com/tangxin-blo ...
- php--yii2.0框架的curl
yii2.0框架的增删改查 //插入操作 save() $customer=new Customer(); $customer->name=‘小熊‘; $customer->save() ...
- readonly=“readonly”与readonly=“true”
<input id="u" readonly /> <input id="u" readonly="readonly" / ...
- asp.net mvc页面javascript代码中如何使用razor
我们需要用<text>将javascript代码包含起来,强制让razor编译器回到内容模式, 或者将javascript代码放在函数中,让razor编译器可以识别,请看下面两个例子: & ...
- js的执行顺序
js是顺序执行的,但是在一个<script></script>标签中,后面的函数会预加载.如: <script type="text/javascript&qu ...
- SET Statements for SQLServer
SET SHOWPLAN_ALL { ON | OFF } It will not execute the TSQL statements. It cannot be specified inside ...
- php自定义错误处理和try{}catch(){}学习
<?php //语法错误 //运行时的错误 //逻辑错误 //php的错误报告级别 // display_errors; // ini_set("display_errors" ...
- sequelize翻译(1)
第一次翻译(由mongoose转了mysql) v 3.0.0 1.Sequelize类 2.sequelize对象 3.sequelize.define()返回的表对象 4.表对象的方法 1.Seq ...
- Ubuntu中Apache修改DocumentRoot(修改网站根目录)
今天配置好Apache+PHP+MySQL但是apache默认DocumentRoot是/var/www想把它改到我Windows下进行测试的k:/wwwroot把 apache2.conf 翻了好几 ...
- java中 set,list,array(集合与数组)相互转换
public static Object[] List2Array(List<Object> oList) { Object[] oArray = oList.toArray(new ...