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

前端 未结 2 1731
情深已故
情深已故 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条回答
  •  萌比男神i
    2021-01-15 05:26

    Don't extend the dialog theme extend the panel theme.

    
    

    This creates a window similar to a dialog except it doesn't center it like a dialog does. Then create an activity like you normally would then start it.

    To make it 5px from left and 10px from top just put padding on your layout

     
       
    

    And of course your activity should just be normal like

    public class NonCenteredDialogActivity extends Activity{
          protected void onCreate(Bundle bundle){
              super.onCreate(bundle);
              setContentView(R.layout.your_layout);
          }
        }
    

提交回复
热议问题