We need to set the orientation of our app to reverse landscape.
Unfortunately, this is only supported in api 9+, so as suggested by a
Google engineer below, we need to set the orientation programmatically
based on android.os.Build.

1) We've tried doing this in onCreate, but it prevents the activity
transitions from showing.    Is there a way to set the orientation
programmatically so that the transitions are still shown?

2) Is there someway of having a conditional in the manifest, such that
screenOrientation defaults to 'reverseLandscape' if supported,
otherwise 'landscape'?

3). It seems reverse landscape can be reached if screenOrientation is
set to 'unsepcified' (even less than api level 9), but then portrait
orientations are allowed as well.  Is there someway to prevent the
portrait orientations (in < api level 9 too)?

Thanks



---------- Forwarded message ----------
From: Stefan Alder <twigbra...@gmail.com>
Date: Sat, Oct 22, 2011 at 11:55 AM
Subject: Re: [android-developers] Landscape Right (reverseLandscape)
prior to API level 9
To: android-developers@googlegroups.com


Dianne,
You mentioned checking the android.os.BUILD and setting the
orientation to reverse landscape only if it meet or exceeds api level
9.  I assume I would do this in onCreate.  If I do do this, there are
no animations to a new Activity (the slide in), only animations when
ending the new activity.   How can I correct this?

FYI, I'm testing on a Nexus One with 2.3.6
Thanks
S



On Wed, Sep 28, 2011 at 12:10 PM, Stefan Alder <twigbra...@gmail.com> wrote:
> I found this thread, which seems related, but the result is a blank
> screen.  Does anyone know if this should still work? and will it apply
> to all children views?
>
> http://groups.google.com/group/android-developers/browse_thread/thread/b4edcc487c1f28d7
>
>        private static class FlipLayout extends FrameLayout {
>                private Matrix mForward = new Matrix();
>                private Matrix mReverse = new Matrix();
>                private float[] mTemp = new float[2];
>
>
>                public FlipLayout(Context context) {
>                        super(context);
>                        mForward.postRotate(180);
>                        mForward.invert(mReverse);
>                }
>
>                @Override
>                protected void dispatchDraw(Canvas canvas) {
>                        canvas.save();
>                        canvas.setMatrix(mForward);
>                        super.dispatchDraw(canvas);
>                        canvas.restore();
>                }
>
>                //@Override
>                public boolean dispatchTouchEvent(MotionEvent event) {
>                        final float[] temp = mTemp;
>                        temp[0] = event.getX();
>                        temp[1] = event.getY();
>
>                        mReverse.mapPoints(temp);
>
>                        event.setLocation(temp[0], temp[1]);
>                        return super.dispatchTouchEvent(event);
>                }
>        }
>
>
> On Wed, Sep 28, 2011 at 2:05 AM, Stefan Alder <twigbra...@gmail.com> wrote:
>> Still looking for a solution to this.  Do I need to set the
>> screenOrientation to 'landscape' in the manifest and then rotate all
>> layouts by 180 degrees?  What's the best way to do this?
>> Thanks
>>
>>
>> On Tue, Sep 27, 2011 at 3:54 PM, Stefan Alder <twigbra...@gmail.com> wrote:
>>> Dianne,
>>> Thanks for the response.  My question is how can I achieve the same
>>> effect when running prior to API level 9.
>>>
>>> On Tue, Sep 27, 2011 at 3:49 PM, Dianne Hackborn <hack...@android.com> 
>>> wrote:
>>>> You'll need to check the API level at android.os.Build, and only set your
>>>> activity to this value when running on API 9 or later.
>>>>
>>>> On Tue, Sep 27, 2011 at 3:45 PM, Stefan Alder <twigbra...@gmail.com> wrote:
>>>>>
>>>>> I trying to ensure that my app and all of its activities are locked to
>>>>> landscape right (reverse landscape) (where the device button and mic
>>>>> located to the left of the screen).    I see you can set the
>>>>> screnOrientation in the manifest to 'reverseLandscape', but this only
>>>>> works for API level 9.
>>>>>
>>>>> What is the best way to achieve this down to API level 6 or 7 such
>>>>> that it will work on all Android devices (portrait and landscape
>>>>> default)?
>>>>>
>>>>> If you can point me to any example where this is done, I'd really
>>>>> appreciate it.
>>>>> Thanks
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Android Developers" group.
>>>>> To post to this group, send email to android-developers@googlegroups.com
>>>>> To unsubscribe from this group, send email to
>>>>> android-developers+unsubscr...@googlegroups.com
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/android-developers?hl=en
>>>>
>>>>
>>>>
>>>> --
>>>> Dianne Hackborn
>>>> Android framework engineer
>>>> hack...@android.com
>>>>
>>>> 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 android-developers@googlegroups.com
>>>> To unsubscribe from this group, send email to
>>>> android-developers+unsubscr...@googlegroups.com
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/android-developers?hl=en
>>>
>>
>

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

Reply via email to