Dialogs can't have an impact on the orientation.  Just make an activity with
a dialog theme, and set the orientation of the activity to the one providing
the behavior you want.

On Thu, May 14, 2009 at 9:11 AM, André <[email protected]> wrote:

>
> Hi all,
>
> I have created an activity for my game which handles all orientation
> changes by itself and has a fixed "portrait" layout. Actually it uses
> the accelerometer and is rendered using 2D canvas methods. If the
> level has been completed I show up a highscore dialog in which the
> user can enter his name. The dialog is floating above the underlying
> level screen which gets blurred out nicely. This generally works.
>
> Problem is that the dialog does not get rotated if the orientation of
> the phone changes. So even if the keyboard is exposed the dialog is
> shown in portrait mode instead of landscape. I have tried to use an
> activity with dialog theme instead but the behavior didn't change.
> After several tries it seems that I have found the reason for this:
> Once there's an activity with fixed orientation in the activity stack
> then all subsequent activities keep this orientation, too. They will
> not react on orientation changes anymore (e.g. if the keyboard gets
> exposed).
>
> After upgrading to 1.5 SDK the described behavior changed a little
> bit. Now at subactivities indead react on orientation changes like
> expected. However, the need to have an opaque background! That means
> that neither dialogs nor activities with dialog theme will work. Those
> will stick with the orientation of the underlaying activity.
>
> So my workaround is to first start a sub-activity with an opaque black
> background. This activity then shows my highscore dialog on top. It
> looks quite okay but I wonder if there's a better solution?
>
> Is it possible to show a dialog above a fixed portrait or landscape
> activity which automatically adapts to orientation changes?
>
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to