package com.example.uiwidgettest2;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.*; public class AlertDialogActivity extends Activity{ private ProgressBar progressBar = null;
private Button btn1 = null; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.edittext); progressBar = (ProgressBar)findViewById(R.id.progress_bar);
btn1 = (Button)findViewById(R.id.button1); btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder dialog = new AlertDialog.Builder(AlertDialogActivity.this);
                dialog.setTitle("警告框");
dialog.setMessage("内容");
dialog.setCancelable(false);
dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) { }
});
dialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) { }
});
dialog.show(); }
}); }

												

Android常见控件— — —AlertDialog的更多相关文章

  1. Android -- 常见控件的小效果

    1,EditText控件 ① 修改光标颜色 自定义drawable 创建cursor.xml文件 <?xml version="1.0" encoding="utf ...

  2. Android --> 常见控件

    1.TextView  主要用于界面上显示一段文本信息 2.Button  用于和用户交互的一个按钮控件 //为Button点击事件注册一个监听器public class Click extends ...

  3. Android常见控件— — —ProgressDialog

    package com.example.uiwidgettest2; import android.app.Activity;import android.app.AlertDialog;import ...

  4. Android常见控件— — —ProgressBar

    ProgressBar用于在界面上显示一个进度条,表示我们的程序正在加载一些数据. <?xml version="1.0" encoding="utf-8" ...

  5. Android常见控件— — —EditText

    <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android=" ...

  6. Android常见控件— — —Button

    <?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android=&qu ...

  7. Android常见控件— — —TextView

    <?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android=&qu ...

  8. Android 基本控件相关知识整理

    Android应用开发的一项重要内容就是界面开发.对于用户来说,不管APP包含的逻辑多么复杂,功能多么强大,如果没有提供友好的图形交互界面,将很难吸引最终用户.作为一个程序员如何才能开发出友好的图形界 ...

  9. Github上star数超1000的Android列表控件

    Android开发中,列表估计是最最常使用到的控件之一了.列表相关的交互如下拉刷新,上拉更多,滑动菜单,拖动排序,滑动菜单,sticky header分组,FAB等等都是十分常见的体验.Github中 ...

随机推荐

  1. [转]Git调用第三方对比工具beyondCompare

    点击阅读原文 对于我这种 git 命令行小白来说, git 自带的对比工具各种水土不服,想念以前的 svn 小乌龟 + beyondCompare 的日子...纠结完 gitHub client 未果 ...

  2. Dynamics AX 2012 R2 配置报表服务器

    今天Reinhard在使用报表的过程中,发现以下错误: The default Report Server Configuration ID could not be found in the SRS ...

  3. iframe显示错误页面

    当系统出现异常时,ifrme中显示的内容为错也页面,而不是罪顶层的框架显示错误内容,此时的解决办法是在错误页面或相关的登录页面中加入 错误页面加载的JS如下 <script type=" ...

  4. 【Java】一个小程序,计算它包含的代码所需的耗时

    写一个小程序,用来计算它包含的代码所需的耗时.虽然简单,测试代码是否耗时还是有点用的,不用重新写嘛~ import java.util.Date; import java.util.concurren ...

  5. 【leetcode❤python】 396. Rotate Function

    #-*- coding: UTF-8 -*- #超时#        lenA=len(A)#        maxSum=[]#        count=0#        while count ...

  6. Sprint(第七天11.20)

    燃尽图

  7. 基于Jquery、JqueryUI插件编写

    刚开始编写jquery插件的时候,只是从网上找个模板看着写,并不理解.刚刚仔细把官网的API看了下,突然觉得豁然开朗了.马上放假了想着应该整理整理不然忘了又. How to create a Jque ...

  8. Nginx模块之————RTMP模块在Ubuntu上以串流直播HLS视频

    Nginx的安装在Ubuntu上以串流直播HLS视频 https://www.vultr.com/docs/setup-nginx-on-ubuntu-to-stream-live-hls-video

  9. caffe中各层的作用:

    关于caffe中的solver: cafffe中的sover的方法都有: Stochastic Gradient Descent (type: "SGD"), AdaDelta ( ...

  10. Shell终端配置

    Shell终端配置 How to: Change / Setup bash custom prompt (PS1) 参考链接:https://www.cyberciti.biz/tips/howto- ...