*普通提示提示对话框:
MainActivity.java:
protect void onCreate(Bundle saveInstanceState) {
super.onCreate(savedInstance);
setContentView(R.layout.activity_main_01);//绑定Activity页面
Button btnNormalDialog = (Button)this.findViewById(R.id.btnHello);
btnNormalDialog.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
AlterDialog.Builder builder = new AlterDialog.Builder(MainActivity.this);
builder.setTitle("温馨提示");
builder.setMessage("你确定是否退出?");
builder.setPositiveButton("确定",new DialogInterface.setOnClickListener(){
Toast.MakeText(MainActivity.this,"你确定删去?",Toast.LENGTH).show();
});
builder.setNegativeButton("否定",new DialogInterface.setOnClickListener(){
@Override
public void onClick(View v){
}
});
builder.setNeutralButton("OK",new DialogInterface.setOnClickListener(){
@Override
public void onClick(View v){
}
});
builder.show();
}
});
}
activity_main_01.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_match="match_parent"
android:layout_height="match_parent"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/btnHello"
android:text="显示框"/>