首页 > 系统 > Android > 正文

Android:自定义Dialog上面高出一部分 去掉

2019-11-09 15:41:30
字体:
来源:转载
供稿:网友

高出的部分是title占的空间;去除就可以。

class TemporaryDialog extends Dialog在自定义的dialog的onCreate方法
this.requestWindowFeature(Window.FEATURE_NO_TITLE);

   @Override    PRotected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        this.requestWindowFeature(Window.FEATURE_NO_TITLE);        setContentView(R.layout.add_temporary_dialog);//        Window window = this.getWindow();//        WindowManager.LayoutParams lp = window.getAttributes();//        window.setBackgroundDrawableResource(android.R.color.transparent);//        lp.width = WindowUtil.getScreenWidth() * 5 / 6;//宽高可设置具体大小//        window.setGravity(Gravity.CENTER);//        window.setAttributes(lp);        //初始化界面控件        initView();    }


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表