开发者

stretch custom dialog horizontally in android

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜