三、常用控件的使用

2018-04-19  本文已影响0人  izhenyue

一、AlertDialog

AlertDialog.Builder builder =new AlertDialog.Builder(Project_Home_Activity.this);

builder.setTitle("This is title");

builder.setMessage("this is Message");

builder.setCancelable(false);

builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {

@Override

    public void onClick(DialogInterface dialogInterface, int i) {

}

});

builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {

@Override

    public void onClick(DialogInterface dialogInterface, int i) {

}

});

builder.show();

二、ProgressDialog

ProgressDialogdialog =new ProgressDialog(Project_Home_Activity.this);

dialog.setTitle("This is ProgressDialog");

dialog.setMessage("Loading...");

dialog.setCancelable(true);

dialog.show();

三、自定义控件

隐藏导航栏

android.support.v7.app.ActionBar actionBar = getSupportActionBar();

if (actionBar !=null) actionBar.hide();

上一篇下一篇

猜你喜欢

热点阅读