Monday, May 9, 2011

[android-developers] Re: I need portrait only for all screen sizes except xlarge screen size which needs to be landscape only

Not simple but doable:

1. Create an abstract custom view MyView with a method "public boolean
isXLarge()"
2. Create two sub classes MyView1 and MyView2. MyView1 returns false
in isXLarge(), MyView2 returns true.
3. Add MyView1 to the three portrait layouts (in layout-small, layout-
normal and layout-large) and MyView2 to the landscape layout (in
layout-xlarge)
4. In your activity get the MyView view (using findViewById) and check
isXLarge(). If the method returns true then set the orientation of the
activity to landscape, otherwise to portrait:
e.g.
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

Emanuel Moecklin
1gravity LLC

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate