`

android : 背景透明的 Dialog

阅读更多
.创建Dialog:
dialog = new Dialog(this,R.style.dialog);
   dialog.setContentView(R.layout.dialog_loading);
  or:
    dialog = new Dialog(this,R.style.NobackDialog);
    LayoutInflater mInflater =  LayoutInflater.from(this);
    View dialogProcessBar = mInflater.inflate(R.layout.dialog_loading,null);
    dialog.setView(dialogProcessBar,0, 0, 0, 0);

控制Dialog 以及内部控件的背景方法:
dialog = new Dialog(this,R.style.dialog);
  WindowManager.LayoutParams lp=dialog.getWindow().getAttributes();
// 模糊度getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND);          dialog.getWindow().setAttributes(lp);
  lp.alpha=0.5f;(0.0-1.0)//透明度,黑暗度为lp.dimAmount=1.0f;

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics