Android studio 使用dialog提示信息
package com.example.androidtest2;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private EditText editText;
private ImageView imageView;
private ProgressBar progressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button) findViewById(R.id.Button);
editText =(EditText) findViewById(R.id.edit_text);
imageView = (ImageView) findViewById(R.id.image_view);
progressBar = (ProgressBar) findViewById(R.id.progress_bar);
button.setOnClickListener(this);
}
public void onClick(View v){
switch (v.getId()){
case R.id.Button:
int progress = progressBar.getProgress();
progress = progress+10;
AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.this);
dialog.setTitle("有个超级重要的信息");
dialog.setMessage("大家手里还有硬币吗?");
dialog.setCancelable(false);
dialog.setPositiveButton("都给你", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
});
dialog.show();
//这里写逻辑
break;
default:
break;
}
}
}
Android studio 使用dialog提示信息的更多相关文章
- 好看的dialog,sweet Alert Dialog 导入Android Studio
系统自带的dialog实在是丑到无法忍受.所以找到了一款比较好的第三方dialog. github 地址如下:https://github.com/pedant/sweet-alert-dialog ...
- Android studio使用android:style/Theme.Dialog报错:You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
查找原因是在activity java代码部分继承了compatactivity public class DialogActivity extends AppCompatActivity 但是在An ...
- Android Studio快速开发之道
概述 现如今开发越来越追求效率和节奏,节省出时间做更多的事情,除了开发技术上的封装等,开发工具的使用技巧也是很重要的,今天就根据自己的经验来给大家介绍一下Android Studio快速开发之道. P ...
- Android Studio各种快捷功能及好用的插件
转载:http://www.jianshu.com/p/c439605a4364 概述 现如今开发越来越追求效率和节奏,节省出时间做更多的事情,除了开发技术上的封装等,开发工具的使用技巧也是很重要的, ...
- [原]在AMD机器上使用android studio
amd机器上使用android studio进行调试.因为amd的cpu不支持IntelVT,所以可能会有如下错误提示 我们有几个选择: 1. 使用真机调试 2. 配合genymotion 3. ...
- android studio 各种问题
1.dexDebug ExecException finished with non-zero exit value 2 全bug日志如下: (Error:Execution failed for t ...
- eclipse项目迁移到android studio(图文最新版)
前言 最近Android studio(下文简称AS)官方发布了正式版,目前火得不行.个人认为主要是因为android是google自家的产品,AS也是他自己搞的IDE,以后的趋势android开发肯 ...
- android studio遇到的问题(记录总结)
SDK 无法更新解决方案 这个问题不是Android Studio的问题,而且由一些一些众所周知的原因导致的,我们这里说下解决办法. 打开SDK Manager,停止更新连接:在界面上方找Tools- ...
- 在Android Studio中使用shareSDK进行社会化分享(图文教程)
[声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/4 ...
- android studio使用说明
一.学习的基本配置文档,搞好各种参数的基本配置,熟练使用. C:\Program Files\Java\jdk1.7.0_09\bin 二.problems meet in weather and ...
随机推荐
- 关于Salesforce存在至于项目的选择List的取值问题
概要: 我们在做项目的时候,经常会遇到一个问题: 一个选择List字段的可选项被另一个选择List制约,这种情况如何在后台取得这两者的对应关系. 原文在这里(侵删): Apexで連動項目の選択肢を取得 ...
- 微信退费报错:SSLHandshakeException No appropriate protocol (protocol is disabled or cipher suites are inappropr)
微信退费报错:No appropriate protocol (protocol is disabled or cipher suites are inappropr) javax.net.ssl.S ...
- HTML基本介绍与操作
一,HTML介绍 HTML,全称是超文本标记语言(HyperText Markup Language),它是一种用于创建网页的标记语言.标记语言是一种将文本(Text)以及文本相关的其他信息结合起来, ...
- Docker命令(转载)
Docker命令 参考资料 Docker文档 https://docs.docker.com 命令格式 docker <选项><命令><参数> Docker命令 ...
- python多线程的问题
参考:https://stackoverflow.com/questions/20939299/does-python-support-multithreading-can-it-speed-up-e ...
- Google在线深度学习神器Colab——科研角色
转载:Google在线深度学习神器Colab - 简书 (jianshu.com) 转载:不FQ,免费使用带GPU和TPU的深度学习开发环境_colab (sohu.com)
- php 滑动图片验证生成
1.话不多说,直接干货,喜欢的希望大家一键三连 <?php namespace App\Model; class VerifyImage { //浮层坐标数组 protected $tailor ...
- 杭电oj 平方和与立方和
给定一段连续的整数,求出他们中所有偶数的平方和以及所有奇数的立方和. Input 输入数据包含多组测试实例,每组测试实例包含一行,由两个整数m和n组成. Output 对于每组输入数据,输出一 ...
- 053_Salesforce Lightning与Classic对比
Classic页面 Lightning页面 特点: 应用程序的切换更加方便 可以快速访问最近项目和备注等 新的记录页面布局 涡轮增压列表视图 仪表板有所变化 圆滑的报告视图 其中最重要的变化也当属 ...
- Linux 服务器安全扫描
工具一:Nmap 1. 探测网络中活跃的主机 nmap -sP 10.0.105.1/24 :探测10.0.105网段中的全部主机 2. 探测主机系统版本 nmap -O IP :探测指定IP的相关数 ...