zoukankan      html  css  js  c++  java
  • 删除对话框

     1 <?xml version="1.0" encoding="utf-8"?>
     2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     3     xmlns:tools="http://schemas.android.com/tools"
     4     android:layout_width="match_parent"
     5     android:layout_height="match_parent"
     6     android:paddingBottom="@dimen/activity_vertical_margin"
     7     android:paddingLeft="@dimen/activity_horizontal_margin"
     8     android:paddingRight="@dimen/activity_horizontal_margin"
     9     android:paddingTop="@dimen/activity_vertical_margin"
    10     tools:context="com.hanqi.testapp2.Zuoye">
    11 
    12     <Button
    13         android:layout_width="match_parent"
    14         android:layout_height="wrap_content"
    15         android:text="删除"
    16         android:onClick="bt1_OnClick"/>
    17 
    18 </RelativeLayout>
     1 <?xml version="1.0" encoding="utf-8"?>
     2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     3     android:orientation="vertical"
     4     android:layout_width="match_parent"
     5     android:layout_height="match_parent">
     6 
     7     <TextView
     8         android:layout_height="wrap_content"
     9         android:text="确定要删除吗?"
    10         android:layout_width="wrap_content" />
    11     <TextView
    12         android:layout_height="wrap_content"
    13         android:text="要删除,请点击“是”。"
    14         android:layout_width="wrap_content" />
    15 
    16 </LinearLayout>
     1 package com.hanqi.testapp2;
     2 
     3 import android.app.AlertDialog;
     4 import android.content.DialogInterface;
     5 import android.os.Bundle;
     6 import android.support.v7.app.AppCompatActivity;
     7 import android.view.View;
     8 import android.widget.Toast;
     9 
    10 public class Zuoye extends AppCompatActivity {
    11 
    12     @Override
    13     protected void onCreate(Bundle savedInstanceState) {
    14         super.onCreate(savedInstanceState);
    15         setContentView(R.layout.activity_zuoye);
    16     }
    17 
    18     public void bt1_OnClick(View v)
    19     {
    20         //View view = View.inflate(this, R.layout.shanchu, null);
    21 
    22         new AlertDialog.Builder(this)
    23                 .setTitle("提示")
    24                 .setView(R.layout.shanchu)
    25                 .setPositiveButton("是", new DialogInterface.OnClickListener() {
    26                     @Override
    27                     public void onClick(DialogInterface dialog, int which) {
    28                         Toast.makeText(Zuoye.this, "执行删除", Toast.LENGTH_SHORT).show();
    29                     }
    30                 })
    31                 .setNegativeButton("否",null)
    32                 .setCancelable(false)
    33                 .show();
    34     }
    35 }

  • 相关阅读:
    uni-app 调用支付宝支付
    PLSQL安装教程,无需oracle客户端(解决本地需要安装oracle客户端的烦恼)
    Java 基于WebMagic 开发的网络爬虫
    android 手机权限管理——PermissionsDispatcher
    Eclipse 上传 删除 下载 分析 hdfs 上的文件
    初见Hadoop—- 搭建MyEclipse 访问HDFS 上的文件
    仿简书登录框,可删除内容或显示密码框的内容
    setFeatureInt、android 自定义标题栏
    Translucent Bar Android状态栏自定义颜色
    仿QQ消息气泡提醒
  • 原文地址:https://www.cnblogs.com/future-zhenzhen/p/5491448.html
Copyright © 2011-2022 走看看