MaterialDialog的用法:

MaterialDialog的用法:

/**
*
* @author smiling
* @date 2016/10
*/

Github:https://github.com/drakeet/MaterialDialoggit

Android Studio 导包:github

compile 'me.drakeet.materialdialog:library:1.3.1'ide

程序:this

MaterialDialog mMaterialDialog = new MaterialDialog(this)
  .setTitle("MaterialDialog")
  .setMessage("Hello world!")
  .setPositiveButton("OK", new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      mMaterialDialog.dismiss();
      ...
    }
  })
  .setNegativeButton("CANCEL", new View.OnClickListener() {
  @Override
  public void onClick(View v) {
      mMaterialDialog.dismiss();
      ...
    }
  });it

mMaterialDialog.show();io

//在展现以前,能够随时更改消息
mMaterialDialog.setTitle("提示");
mMaterialDialog.show();
//显示后,也能够随时更改消息
mMaterialDialog.setMessage("你好,世界~");date

setView (View v) & setContentView():List

EditText contentView = new EditText(this);
MaterialDialog mMaterialDialog = new MaterialDialog(this).setView(contentView);程序

mMaterialDialog.show();di

setBackgroundResource(int resId) or setBackground(Drawable drawable):

mMaterialDialog.setBackgroundResource(R.drawable.background);

相关文章
相关标签/搜索