简体   繁体   中英

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

Here is the method I tried for dialog from bottom

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

This is how you render the Dialog at the bottom :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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