android:layout_height=“wrap_content”
android:text=“两个按钮”/>
android:id="@+id/button1" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“三个按钮”/> android:id="@+id/button2" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“列表”/> android:id="@+id/button3" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“单选”/> android:id="@+id/button4" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“多选”/> android:id="@+id/button5" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“等待”/> android:id="@+id/button6" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“进度条”/> android:id="@+id/button7" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“编辑”/> MainActivity.java中,这里先把按钮后获取过来了,后面的对话框样式代码分开写的(普通对话框)。 import java.util.ArrayList; import android.app.Activity; import android.app.alertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity implements onClickListener { private Button button; private Button button1; private Button button2; private Button button3; private Button button4; private Button button5; private Button button6; private Button button7; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (Button) findViewById(R.id.button); button1 = (Button) findViewById(R.id.button1); button2 = (Button) findViewById(R.id.button2); button3 = (Button) findViewById(R.id.button3); button4 = (Button) findViewById(R.id.button4); button5 = (Button) findViewById(R.id.button5); button6 = (Button) findViewById(R.id.button6); button7 = (Button) findViewById(R.id.button7); button.setonClickListener(this); button1.setonClickListener(this); button2.setonClickListener(this); button3.setonClickListener(this); button4.setonClickListener(this); button5.setonClickListener(this); button6.setonClickListener(this); button7.setonClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.button: //两个按钮 showNorMalDialog(); break; case R.id.button1: //三个按钮 showMultiBtnDialog(); break; case R.id.button2: //列表 showListDialog(); break; case R.id.button3: //单选按钮 showSingleChoiceDialog(); break; case R.id.button4: //多选按钮 showMultiChoiceDialog(); break; case R.id.button5: //等待 showWaitingDialog(); break; case R.id.button6: //进度条 showProgressDialog(); break; case R.id.button7: //编辑 showInputDialog(); break; default: break; } } //三个按钮 private void showMultiBtnDialog() { alertDialog.Builder normalDialog = new alertDialog.Builder(MainActivity.this); //设置对话框图标 normalDialog.setIcon(R.drawable.ic_launcher); //设置对话框标题 normalDialog.setTitle(“对话框标题”); //设置对话框消息提示 normalDialog.setMessage(“对话框内容提示”); //按钮一 normalDialog.setPositiveButton(“按钮1”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮1”, Toast.LENGTH_LONG).show(); } } ); //按钮二 normalDialog.setNeutralButton(“按钮2”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮2”, Toast.LENGTH_LONG).show(); } } ); //按钮三 normalDialog.setNegativeButton(“按钮3”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮3”, Toast.LENGTH_LONG).show(); } } ); normalDialog.show(); } //两个按钮 private void showNorMalDialog() { alertDialog.Builder normalDialog = new alertDialog.Builder(MainActivity.this); //设置对话框图标 normalDialog.setIcon(R.drawable.ic_launcher); //设置对话框标题 normalDialog.setTitle(“对话框标题”); //设置对话框消息提示 normalDialog.setMessage(“对话框内容提示”); //setPositiveButton确定按钮 normalDialog.setPositiveButton(“确定”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “确定按钮”, Toast.LENGTH_LONG).show(); } } ); //setNegativeButton取消按钮 normalDialog.setNegativeButton(“取消”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “取消按钮”, Toast.LENGTH_LONG).show(); } } ); //显示 normalDialog.show(); } } 列表: 总结 本文讲解了我对Android开发现状的一些看法,也许有些人会觉得我的观点不对,但我认为没有绝对的对与错,一切交给时间去证明吧!愿与各位坚守的同胞们互相学习,共同进步! 在这里我也分享一份自己收录整理的**Android学习PDF+架构视频+面试文档+源码笔记,还有高级架构技术进阶脑图、Android开发面试专题资料,高级进阶架构资料**帮助大家学习提升进阶,也节省大家在网上搜索资料的时间来学习,也可以分享给身边好友一起学习
android:id="@+id/button1"
android:layout_width=“match_parent”
android:text=“三个按钮”/>
android:id="@+id/button2" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“列表”/> android:id="@+id/button3" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“单选”/> android:id="@+id/button4" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“多选”/> android:id="@+id/button5" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“等待”/> android:id="@+id/button6" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“进度条”/> android:id="@+id/button7" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“编辑”/> MainActivity.java中,这里先把按钮后获取过来了,后面的对话框样式代码分开写的(普通对话框)。 import java.util.ArrayList; import android.app.Activity; import android.app.alertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity implements onClickListener { private Button button; private Button button1; private Button button2; private Button button3; private Button button4; private Button button5; private Button button6; private Button button7; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (Button) findViewById(R.id.button); button1 = (Button) findViewById(R.id.button1); button2 = (Button) findViewById(R.id.button2); button3 = (Button) findViewById(R.id.button3); button4 = (Button) findViewById(R.id.button4); button5 = (Button) findViewById(R.id.button5); button6 = (Button) findViewById(R.id.button6); button7 = (Button) findViewById(R.id.button7); button.setonClickListener(this); button1.setonClickListener(this); button2.setonClickListener(this); button3.setonClickListener(this); button4.setonClickListener(this); button5.setonClickListener(this); button6.setonClickListener(this); button7.setonClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.button: //两个按钮 showNorMalDialog(); break; case R.id.button1: //三个按钮 showMultiBtnDialog(); break; case R.id.button2: //列表 showListDialog(); break; case R.id.button3: //单选按钮 showSingleChoiceDialog(); break; case R.id.button4: //多选按钮 showMultiChoiceDialog(); break; case R.id.button5: //等待 showWaitingDialog(); break; case R.id.button6: //进度条 showProgressDialog(); break; case R.id.button7: //编辑 showInputDialog(); break; default: break; } } //三个按钮 private void showMultiBtnDialog() { alertDialog.Builder normalDialog = new alertDialog.Builder(MainActivity.this); //设置对话框图标 normalDialog.setIcon(R.drawable.ic_launcher); //设置对话框标题 normalDialog.setTitle(“对话框标题”); //设置对话框消息提示 normalDialog.setMessage(“对话框内容提示”); //按钮一 normalDialog.setPositiveButton(“按钮1”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮1”, Toast.LENGTH_LONG).show(); } } ); //按钮二 normalDialog.setNeutralButton(“按钮2”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮2”, Toast.LENGTH_LONG).show(); } } ); //按钮三 normalDialog.setNegativeButton(“按钮3”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮3”, Toast.LENGTH_LONG).show(); } } ); normalDialog.show(); } //两个按钮 private void showNorMalDialog() { alertDialog.Builder normalDialog = new alertDialog.Builder(MainActivity.this); //设置对话框图标 normalDialog.setIcon(R.drawable.ic_launcher); //设置对话框标题 normalDialog.setTitle(“对话框标题”); //设置对话框消息提示 normalDialog.setMessage(“对话框内容提示”); //setPositiveButton确定按钮 normalDialog.setPositiveButton(“确定”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “确定按钮”, Toast.LENGTH_LONG).show(); } } ); //setNegativeButton取消按钮 normalDialog.setNegativeButton(“取消”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “取消按钮”, Toast.LENGTH_LONG).show(); } } ); //显示 normalDialog.show(); } } 列表: 总结 本文讲解了我对Android开发现状的一些看法,也许有些人会觉得我的观点不对,但我认为没有绝对的对与错,一切交给时间去证明吧!愿与各位坚守的同胞们互相学习,共同进步! 在这里我也分享一份自己收录整理的**Android学习PDF+架构视频+面试文档+源码笔记,还有高级架构技术进阶脑图、Android开发面试专题资料,高级进阶架构资料**帮助大家学习提升进阶,也节省大家在网上搜索资料的时间来学习,也可以分享给身边好友一起学习
android:id="@+id/button2"
android:text=“列表”/>
android:id="@+id/button3" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“单选”/> android:id="@+id/button4" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“多选”/> android:id="@+id/button5" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“等待”/> android:id="@+id/button6" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“进度条”/> android:id="@+id/button7" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“编辑”/> MainActivity.java中,这里先把按钮后获取过来了,后面的对话框样式代码分开写的(普通对话框)。 import java.util.ArrayList; import android.app.Activity; import android.app.alertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity implements onClickListener { private Button button; private Button button1; private Button button2; private Button button3; private Button button4; private Button button5; private Button button6; private Button button7; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (Button) findViewById(R.id.button); button1 = (Button) findViewById(R.id.button1); button2 = (Button) findViewById(R.id.button2); button3 = (Button) findViewById(R.id.button3); button4 = (Button) findViewById(R.id.button4); button5 = (Button) findViewById(R.id.button5); button6 = (Button) findViewById(R.id.button6); button7 = (Button) findViewById(R.id.button7); button.setonClickListener(this); button1.setonClickListener(this); button2.setonClickListener(this); button3.setonClickListener(this); button4.setonClickListener(this); button5.setonClickListener(this); button6.setonClickListener(this); button7.setonClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.button: //两个按钮 showNorMalDialog(); break; case R.id.button1: //三个按钮 showMultiBtnDialog(); break; case R.id.button2: //列表 showListDialog(); break; case R.id.button3: //单选按钮 showSingleChoiceDialog(); break; case R.id.button4: //多选按钮 showMultiChoiceDialog(); break; case R.id.button5: //等待 showWaitingDialog(); break; case R.id.button6: //进度条 showProgressDialog(); break; case R.id.button7: //编辑 showInputDialog(); break; default: break; } } //三个按钮 private void showMultiBtnDialog() { alertDialog.Builder normalDialog = new alertDialog.Builder(MainActivity.this); //设置对话框图标 normalDialog.setIcon(R.drawable.ic_launcher); //设置对话框标题 normalDialog.setTitle(“对话框标题”); //设置对话框消息提示 normalDialog.setMessage(“对话框内容提示”); //按钮一 normalDialog.setPositiveButton(“按钮1”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮1”, Toast.LENGTH_LONG).show(); } } ); //按钮二 normalDialog.setNeutralButton(“按钮2”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮2”, Toast.LENGTH_LONG).show(); } } ); //按钮三 normalDialog.setNegativeButton(“按钮3”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮3”, Toast.LENGTH_LONG).show(); } } ); normalDialog.show(); } //两个按钮 private void showNorMalDialog() { alertDialog.Builder normalDialog = new alertDialog.Builder(MainActivity.this); //设置对话框图标 normalDialog.setIcon(R.drawable.ic_launcher); //设置对话框标题 normalDialog.setTitle(“对话框标题”); //设置对话框消息提示 normalDialog.setMessage(“对话框内容提示”); //setPositiveButton确定按钮 normalDialog.setPositiveButton(“确定”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “确定按钮”, Toast.LENGTH_LONG).show(); } } ); //setNegativeButton取消按钮 normalDialog.setNegativeButton(“取消”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “取消按钮”, Toast.LENGTH_LONG).show(); } } ); //显示 normalDialog.show(); } } 列表: 总结 本文讲解了我对Android开发现状的一些看法,也许有些人会觉得我的观点不对,但我认为没有绝对的对与错,一切交给时间去证明吧!愿与各位坚守的同胞们互相学习,共同进步! 在这里我也分享一份自己收录整理的**Android学习PDF+架构视频+面试文档+源码笔记,还有高级架构技术进阶脑图、Android开发面试专题资料,高级进阶架构资料**帮助大家学习提升进阶,也节省大家在网上搜索资料的时间来学习,也可以分享给身边好友一起学习
android:id="@+id/button3"
android:text=“单选”/>
android:id="@+id/button4" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“多选”/> android:id="@+id/button5" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“等待”/> android:id="@+id/button6" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“进度条”/> android:id="@+id/button7" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“编辑”/> MainActivity.java中,这里先把按钮后获取过来了,后面的对话框样式代码分开写的(普通对话框)。 import java.util.ArrayList; import android.app.Activity; import android.app.alertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity implements onClickListener { private Button button; private Button button1; private Button button2; private Button button3; private Button button4; private Button button5; private Button button6; private Button button7; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (Button) findViewById(R.id.button); button1 = (Button) findViewById(R.id.button1); button2 = (Button) findViewById(R.id.button2); button3 = (Button) findViewById(R.id.button3); button4 = (Button) findViewById(R.id.button4); button5 = (Button) findViewById(R.id.button5); button6 = (Button) findViewById(R.id.button6); button7 = (Button) findViewById(R.id.button7); button.setonClickListener(this); button1.setonClickListener(this); button2.setonClickListener(this); button3.setonClickListener(this); button4.setonClickListener(this); button5.setonClickListener(this); button6.setonClickListener(this); button7.setonClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.button: //两个按钮 showNorMalDialog(); break; case R.id.button1: //三个按钮 showMultiBtnDialog(); break; case R.id.button2: //列表 showListDialog(); break; case R.id.button3: //单选按钮 showSingleChoiceDialog(); break; case R.id.button4: //多选按钮 showMultiChoiceDialog(); break; case R.id.button5: //等待 showWaitingDialog(); break; case R.id.button6: //进度条 showProgressDialog(); break; case R.id.button7: //编辑 showInputDialog(); break; default: break; } } //三个按钮 private void showMultiBtnDialog() { alertDialog.Builder normalDialog = new alertDialog.Builder(MainActivity.this); //设置对话框图标 normalDialog.setIcon(R.drawable.ic_launcher); //设置对话框标题 normalDialog.setTitle(“对话框标题”); //设置对话框消息提示 normalDialog.setMessage(“对话框内容提示”); //按钮一 normalDialog.setPositiveButton(“按钮1”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮1”, Toast.LENGTH_LONG).show(); } } ); //按钮二 normalDialog.setNeutralButton(“按钮2”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮2”, Toast.LENGTH_LONG).show(); } } ); //按钮三 normalDialog.setNegativeButton(“按钮3”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮3”, Toast.LENGTH_LONG).show(); } } ); normalDialog.show(); } //两个按钮 private void showNorMalDialog() { alertDialog.Builder normalDialog = new alertDialog.Builder(MainActivity.this); //设置对话框图标 normalDialog.setIcon(R.drawable.ic_launcher); //设置对话框标题 normalDialog.setTitle(“对话框标题”); //设置对话框消息提示 normalDialog.setMessage(“对话框内容提示”); //setPositiveButton确定按钮 normalDialog.setPositiveButton(“确定”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “确定按钮”, Toast.LENGTH_LONG).show(); } } ); //setNegativeButton取消按钮 normalDialog.setNegativeButton(“取消”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “取消按钮”, Toast.LENGTH_LONG).show(); } } ); //显示 normalDialog.show(); } } 列表: 总结 本文讲解了我对Android开发现状的一些看法,也许有些人会觉得我的观点不对,但我认为没有绝对的对与错,一切交给时间去证明吧!愿与各位坚守的同胞们互相学习,共同进步! 在这里我也分享一份自己收录整理的**Android学习PDF+架构视频+面试文档+源码笔记,还有高级架构技术进阶脑图、Android开发面试专题资料,高级进阶架构资料**帮助大家学习提升进阶,也节省大家在网上搜索资料的时间来学习,也可以分享给身边好友一起学习
android:id="@+id/button4"
android:text=“多选”/>
android:id="@+id/button5" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“等待”/> android:id="@+id/button6" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“进度条”/> android:id="@+id/button7" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“编辑”/> MainActivity.java中,这里先把按钮后获取过来了,后面的对话框样式代码分开写的(普通对话框)。 import java.util.ArrayList; import android.app.Activity; import android.app.alertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity implements onClickListener { private Button button; private Button button1; private Button button2; private Button button3; private Button button4; private Button button5; private Button button6; private Button button7; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (Button) findViewById(R.id.button); button1 = (Button) findViewById(R.id.button1); button2 = (Button) findViewById(R.id.button2); button3 = (Button) findViewById(R.id.button3); button4 = (Button) findViewById(R.id.button4); button5 = (Button) findViewById(R.id.button5); button6 = (Button) findViewById(R.id.button6); button7 = (Button) findViewById(R.id.button7); button.setonClickListener(this); button1.setonClickListener(this); button2.setonClickListener(this); button3.setonClickListener(this); button4.setonClickListener(this); button5.setonClickListener(this); button6.setonClickListener(this); button7.setonClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.button: //两个按钮 showNorMalDialog(); break; case R.id.button1: //三个按钮 showMultiBtnDialog(); break; case R.id.button2: //列表 showListDialog(); break; case R.id.button3: //单选按钮 showSingleChoiceDialog(); break; case R.id.button4: //多选按钮 showMultiChoiceDialog(); break; case R.id.button5: //等待 showWaitingDialog(); break; case R.id.button6: //进度条 showProgressDialog(); break; case R.id.button7: //编辑 showInputDialog(); break; default: break; } } //三个按钮 private void showMultiBtnDialog() { alertDialog.Builder normalDialog = new alertDialog.Builder(MainActivity.this); //设置对话框图标 normalDialog.setIcon(R.drawable.ic_launcher); //设置对话框标题 normalDialog.setTitle(“对话框标题”); //设置对话框消息提示 normalDialog.setMessage(“对话框内容提示”); //按钮一 normalDialog.setPositiveButton(“按钮1”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮1”, Toast.LENGTH_LONG).show(); } } ); //按钮二 normalDialog.setNeutralButton(“按钮2”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮2”, Toast.LENGTH_LONG).show(); } } ); //按钮三 normalDialog.setNegativeButton(“按钮3”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮3”, Toast.LENGTH_LONG).show(); } } ); normalDialog.show(); } //两个按钮 private void showNorMalDialog() { alertDialog.Builder normalDialog = new alertDialog.Builder(MainActivity.this); //设置对话框图标 normalDialog.setIcon(R.drawable.ic_launcher); //设置对话框标题 normalDialog.setTitle(“对话框标题”); //设置对话框消息提示 normalDialog.setMessage(“对话框内容提示”); //setPositiveButton确定按钮 normalDialog.setPositiveButton(“确定”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “确定按钮”, Toast.LENGTH_LONG).show(); } } ); //setNegativeButton取消按钮 normalDialog.setNegativeButton(“取消”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “取消按钮”, Toast.LENGTH_LONG).show(); } } ); //显示 normalDialog.show(); } } 列表: 总结 本文讲解了我对Android开发现状的一些看法,也许有些人会觉得我的观点不对,但我认为没有绝对的对与错,一切交给时间去证明吧!愿与各位坚守的同胞们互相学习,共同进步! 在这里我也分享一份自己收录整理的**Android学习PDF+架构视频+面试文档+源码笔记,还有高级架构技术进阶脑图、Android开发面试专题资料,高级进阶架构资料**帮助大家学习提升进阶,也节省大家在网上搜索资料的时间来学习,也可以分享给身边好友一起学习
android:id="@+id/button5"
android:text=“等待”/>
android:id="@+id/button6" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“进度条”/> android:id="@+id/button7" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“编辑”/> MainActivity.java中,这里先把按钮后获取过来了,后面的对话框样式代码分开写的(普通对话框)。 import java.util.ArrayList; import android.app.Activity; import android.app.alertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity implements onClickListener { private Button button; private Button button1; private Button button2; private Button button3; private Button button4; private Button button5; private Button button6; private Button button7; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (Button) findViewById(R.id.button); button1 = (Button) findViewById(R.id.button1); button2 = (Button) findViewById(R.id.button2); button3 = (Button) findViewById(R.id.button3); button4 = (Button) findViewById(R.id.button4); button5 = (Button) findViewById(R.id.button5); button6 = (Button) findViewById(R.id.button6); button7 = (Button) findViewById(R.id.button7); button.setonClickListener(this); button1.setonClickListener(this); button2.setonClickListener(this); button3.setonClickListener(this); button4.setonClickListener(this); button5.setonClickListener(this); button6.setonClickListener(this); button7.setonClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.button: //两个按钮 showNorMalDialog(); break; case R.id.button1: //三个按钮 showMultiBtnDialog(); break; case R.id.button2: //列表 showListDialog(); break; case R.id.button3: //单选按钮 showSingleChoiceDialog(); break; case R.id.button4: //多选按钮 showMultiChoiceDialog(); break; case R.id.button5: //等待 showWaitingDialog(); break; case R.id.button6: //进度条 showProgressDialog(); break; case R.id.button7: //编辑 showInputDialog(); break; default: break; } } //三个按钮 private void showMultiBtnDialog() { alertDialog.Builder normalDialog = new alertDialog.Builder(MainActivity.this); //设置对话框图标 normalDialog.setIcon(R.drawable.ic_launcher); //设置对话框标题 normalDialog.setTitle(“对话框标题”); //设置对话框消息提示 normalDialog.setMessage(“对话框内容提示”); //按钮一 normalDialog.setPositiveButton(“按钮1”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮1”, Toast.LENGTH_LONG).show(); } } ); //按钮二 normalDialog.setNeutralButton(“按钮2”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮2”, Toast.LENGTH_LONG).show(); } } ); //按钮三 normalDialog.setNegativeButton(“按钮3”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮3”, Toast.LENGTH_LONG).show(); } } ); normalDialog.show(); } //两个按钮 private void showNorMalDialog() { alertDialog.Builder normalDialog = new alertDialog.Builder(MainActivity.this); //设置对话框图标 normalDialog.setIcon(R.drawable.ic_launcher); //设置对话框标题 normalDialog.setTitle(“对话框标题”); //设置对话框消息提示 normalDialog.setMessage(“对话框内容提示”); //setPositiveButton确定按钮 normalDialog.setPositiveButton(“确定”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “确定按钮”, Toast.LENGTH_LONG).show(); } } ); //setNegativeButton取消按钮 normalDialog.setNegativeButton(“取消”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “取消按钮”, Toast.LENGTH_LONG).show(); } } ); //显示 normalDialog.show(); } } 列表: 总结 本文讲解了我对Android开发现状的一些看法,也许有些人会觉得我的观点不对,但我认为没有绝对的对与错,一切交给时间去证明吧!愿与各位坚守的同胞们互相学习,共同进步! 在这里我也分享一份自己收录整理的**Android学习PDF+架构视频+面试文档+源码笔记,还有高级架构技术进阶脑图、Android开发面试专题资料,高级进阶架构资料**帮助大家学习提升进阶,也节省大家在网上搜索资料的时间来学习,也可以分享给身边好友一起学习
android:id="@+id/button6"
android:text=“进度条”/>
android:id="@+id/button7" android:layout_width=“match_parent” android:layout_height=“wrap_content” android:text=“编辑”/> MainActivity.java中,这里先把按钮后获取过来了,后面的对话框样式代码分开写的(普通对话框)。 import java.util.ArrayList; import android.app.Activity; import android.app.alertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity implements onClickListener { private Button button; private Button button1; private Button button2; private Button button3; private Button button4; private Button button5; private Button button6; private Button button7; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (Button) findViewById(R.id.button); button1 = (Button) findViewById(R.id.button1); button2 = (Button) findViewById(R.id.button2); button3 = (Button) findViewById(R.id.button3); button4 = (Button) findViewById(R.id.button4); button5 = (Button) findViewById(R.id.button5); button6 = (Button) findViewById(R.id.button6); button7 = (Button) findViewById(R.id.button7); button.setonClickListener(this); button1.setonClickListener(this); button2.setonClickListener(this); button3.setonClickListener(this); button4.setonClickListener(this); button5.setonClickListener(this); button6.setonClickListener(this); button7.setonClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.button: //两个按钮 showNorMalDialog(); break; case R.id.button1: //三个按钮 showMultiBtnDialog(); break; case R.id.button2: //列表 showListDialog(); break; case R.id.button3: //单选按钮 showSingleChoiceDialog(); break; case R.id.button4: //多选按钮 showMultiChoiceDialog(); break; case R.id.button5: //等待 showWaitingDialog(); break; case R.id.button6: //进度条 showProgressDialog(); break; case R.id.button7: //编辑 showInputDialog(); break; default: break; } } //三个按钮 private void showMultiBtnDialog() { alertDialog.Builder normalDialog = new alertDialog.Builder(MainActivity.this); //设置对话框图标 normalDialog.setIcon(R.drawable.ic_launcher); //设置对话框标题 normalDialog.setTitle(“对话框标题”); //设置对话框消息提示 normalDialog.setMessage(“对话框内容提示”); //按钮一 normalDialog.setPositiveButton(“按钮1”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮1”, Toast.LENGTH_LONG).show(); } } ); //按钮二 normalDialog.setNeutralButton(“按钮2”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮2”, Toast.LENGTH_LONG).show(); } } ); //按钮三 normalDialog.setNegativeButton(“按钮3”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “按钮3”, Toast.LENGTH_LONG).show(); } } ); normalDialog.show(); } //两个按钮 private void showNorMalDialog() { alertDialog.Builder normalDialog = new alertDialog.Builder(MainActivity.this); //设置对话框图标 normalDialog.setIcon(R.drawable.ic_launcher); //设置对话框标题 normalDialog.setTitle(“对话框标题”); //设置对话框消息提示 normalDialog.setMessage(“对话框内容提示”); //setPositiveButton确定按钮 normalDialog.setPositiveButton(“确定”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “确定按钮”, Toast.LENGTH_LONG).show(); } } ); //setNegativeButton取消按钮 normalDialog.setNegativeButton(“取消”, new DialogInterface.onClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(MainActivity.this, “取消按钮”, Toast.LENGTH_LONG).show(); } } ); //显示 normalDialog.show(); } } 列表: 总结 本文讲解了我对Android开发现状的一些看法,也许有些人会觉得我的观点不对,但我认为没有绝对的对与错,一切交给时间去证明吧!愿与各位坚守的同胞们互相学习,共同进步! 在这里我也分享一份自己收录整理的**Android学习PDF+架构视频+面试文档+源码笔记,还有高级架构技术进阶脑图、Android开发面试专题资料,高级进阶架构资料**帮助大家学习提升进阶,也节省大家在网上搜索资料的时间来学习,也可以分享给身边好友一起学习
android:id="@+id/button7"
android:text=“编辑”/>
MainActivity.java中,这里先把按钮后获取过来了,后面的对话框样式代码分开写的(普通对话框)。
import java.util.ArrayList;
import android.app.Activity;
import android.app.alertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends Activity implements onClickListener {
private Button button;
private Button button1;
private Button button2;
private Button button3;
private Button button4;
private Button button5;
private Button button6;
private Button button7;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = (Button) findViewById(R.id.button);
button1 = (Button) findViewById(R.id.button1);
button2 = (Button) findViewById(R.id.button2);
button3 = (Button) findViewById(R.id.button3);
button4 = (Button) findViewById(R.id.button4);
button5 = (Button) findViewById(R.id.button5);
button6 = (Button) findViewById(R.id.button6);
button7 = (Button) findViewById(R.id.button7);
button.setonClickListener(this);
button1.setonClickListener(this);
button2.setonClickListener(this);
button3.setonClickListener(this);
button4.setonClickListener(this);
button5.setonClickListener(this);
button6.setonClickListener(this);
button7.setonClickListener(this);
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.button: //两个按钮
showNorMalDialog();
break;
case R.id.button1: //三个按钮
showMultiBtnDialog();
case R.id.button2: //列表
showListDialog();
case R.id.button3: //单选按钮
showSingleChoiceDialog();
case R.id.button4: //多选按钮
showMultiChoiceDialog();
case R.id.button5: //等待
showWaitingDialog();
case R.id.button6: //进度条
showProgressDialog();
case R.id.button7: //编辑
showInputDialog();
default:
//三个按钮
private void showMultiBtnDialog() {
alertDialog.Builder normalDialog = new alertDialog.Builder(MainActivity.this);
//设置对话框图标
normalDialog.setIcon(R.drawable.ic_launcher);
//设置对话框标题
normalDialog.setTitle(“对话框标题”);
//设置对话框消息提示
normalDialog.setMessage(“对话框内容提示”);
//按钮一
normalDialog.setPositiveButton(“按钮1”,
new DialogInterface.onClickListener() {
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(MainActivity.this, “按钮1”, Toast.LENGTH_LONG).show();
);
//按钮二
normalDialog.setNeutralButton(“按钮2”,
Toast.makeText(MainActivity.this, “按钮2”, Toast.LENGTH_LONG).show();
//按钮三
normalDialog.setNegativeButton(“按钮3”,
Toast.makeText(MainActivity.this, “按钮3”, Toast.LENGTH_LONG).show();
normalDialog.show();
//两个按钮
private void showNorMalDialog() {
//setPositiveButton确定按钮
normalDialog.setPositiveButton(“确定”,
Toast.makeText(MainActivity.this, “确定按钮”, Toast.LENGTH_LONG).show();
//setNegativeButton取消按钮
normalDialog.setNegativeButton(“取消”,
Toast.makeText(MainActivity.this, “取消按钮”, Toast.LENGTH_LONG).show();
//显示
列表:
本文讲解了我对Android开发现状的一些看法,也许有些人会觉得我的观点不对,但我认为没有绝对的对与错,一切交给时间去证明吧!愿与各位坚守的同胞们互相学习,共同进步!
在这里我也分享一份自己收录整理的**Android学习PDF+架构视频+面试文档+源码笔记,还有高级架构技术进阶脑图、Android开发面试专题资料,高级进阶架构资料**帮助大家学习提升进阶,也节省大家在网上搜索资料的时间来学习,也可以分享给身边好友一起学习
上一篇 【如何对各种Map进行排序?】
下一篇 【Java】------- Base64格式图片保存到服务器文件
版权所有 (c)2021-2022 MSHXW.COM
ICP备案号:晋ICP备2021003244-6号