开发者

stretch custom dialog horizontally in android

开发者 https://www.devze.com 2023-03-14 01:56 出处:网络
I am tryting to customize a alert dialog in android but the problem is i want to make dialog over the side of the screen too , that i means i want my dialog to be fit horizontally without any extra ga

I am tryting to customize a alert dialog in android but the problem is i want to make dialog over the side of the screen too , that i means i want my dialog to be fit horizontally without any extra gap. So far i have written following code inside onDialog overridden method of Activity. but i am still getting gaps on both the side. I want dialog with Relative to the layout

stretch custom dialog horizontally in android

            LayoutInflater factory = LayoutInflater.from(this);
            final View EntryView = factory.inflate(R.layout.mc_custom_dlg, null);

            final AlertDialog.Builder alertDialog =  new AlertDialog.Builder(this);

       开发者_如何学编程     alertDialog.setCancelable(true);
            alertDialog.setView(EntryView);
            alertDialog.setInverseBackgroundForced(true);
            Dialog directionDlg = alertDialog.create();
            directionDlg.requestWindowFeature(Window.FEATURE_NO_TITLE);

             WindowManager.LayoutParams wndParams = directionDlg.getWindow().getAttributes();            
             wndParams.flags=LayoutParams.FLAG_LAYOUT_NO_LIMITS | LayoutParams.FLAG_NOT_TOUCH_MODAL;
             wndParams.x=0;
             wndParams.y=-70;
             wndParams.gravity=-1; 
             wndParams.dimAmount=0;


             directionDlg.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
0

精彩评论

暂无评论...
验证码 换一张
取 消