Here is an example from a utility class that my activities use: public static void setOrientation(Activity activity){ if(SettingsHelper.getInstance(activity).getOrientationMode() ==Settings.OrientationMode_Sensor&&activity.getResources ().getConfiguration ().keyboardHidden==Configuration.KEYBOARDHIDDEN_YES) activity.setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_SENSOR); else if(SettingsHelper.getInstance(activity).getOrientationMode() ==Settings.OrientationMode_Vertical&&activity.getResources ().getConfiguration ().keyboardHidden==Configuration.KEYBOARDHIDDEN_YES) activity.setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); else activity.setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }
SettingsHelper and Settings are my own custom classes. On Apr 2, 12:47 pm, djr <ryand...@gmail.com> wrote: > setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); or > whatever orientation you want. > > On Apr 2, 1:16 am, Eric <zhu.yu...@zte.com.cn> wrote: > > > Hi,all > > > How can I change the Android view from horizontal to Vertical by > > force? Can the view switch dynamicly? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---