繁体   English   中英

我怎样才能从底部打开对话框,但它只会显示在Android屏幕底部的一半之间

[英]How can I open the dialog from bottom but it will be show only in between half of the screen from bottom in android

这是我尝试从底部进行对话框的方法

   dialog = new Dialog(activity, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.coachingtip_discover);
        ImageView imageclose = (ImageView) dialog.findViewById(R.id.btn_close1);

        TextView textsmg = (TextView) dialog.findViewById(R.id.discover_inspire_text);

        TextView textsmg2 = (TextView) dialog.findViewById(R.id.add_photo_text2);

        TextView textsmg3 = (TextView) dialog.findViewById(R.id.add_photo_text1);

        dialog.show();

这是在底部渲染Dialog的方式:

dialog = new Dialog(activity, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.coachingtip_discover);
Window window = dialog.getWindow();
WindowManager.LayoutParams wlp = window.getAttributes();

wlp.gravity = Gravity.BOTTOM;
wlp.flags &= ~WindowManager.LayoutParams.FLAG_DIM_BEHIND;
window.setAttributes(wlp);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM