3

i know this question was asked for aligning a dialog on the left, but here i'm using an activity with a

android:theme="@android:style/Theme.Dialog" and the problem is that it's display at the center of the screen and i want to display on the top left corner.

is there any way to do so ?

i have tried using the android:layout_gravity="top|left" on my concerned activity .xml but that doesn't work.

Thank you for your help

Sebastien H.
  • 6,818
  • 2
  • 28
  • 36

1 Answers1

7

Try this on your onCreate of dialog activity

WindowManager.LayoutParams wmlp = getWindow().getAttributes();

        wmlp.gravity = Gravity.TOP | Gravity.LEFT;

Hope it helps.

Oam
  • 912
  • 6
  • 7