Positon an Acitvity applied with a theme dialog at a particular x, y position

前端 未结 2 1707
情深已故
情深已故 2021-01-15 04:53

I would like to place the dialog on a particular position on the screen(-10px from top and -5px from let).

I did apply the theme and added the android:scrollX<

2条回答
  •  时光说笑
    2021-01-15 05:24

    This is the code!

    LayoutParams lp = this.getWindow().getAttributes();
                 lp.x=50;lp.y=20;lp.width=100;lp.height=200;lp.gravity=Gravity.TOP | Gravity.LEFT;
                lp.dimAmount=0;            
                lp.flags=LayoutParams.FLAG_LAYOUT_NO_LIMITS | LayoutParams.FLAG_NOT_TOUCH_MODAL;
    this.setContentView(view, lp);
    

提交回复
热议问题