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);