Sebastien H.
Sebastien H.

Reputation: 7196

Align an activity as dialog on top left

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

Upvotes: 3

Views: 2683

Answers (1)

Oam
Oam

Reputation: 922

Try this on your onCreate of dialog activity

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

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

Hope it helps.

Upvotes: 7

Related Questions