Force Tablet To Be In Landscape Mode
Is there a way to force the tablet to be in landscape mode as default orientation when the user start's my app. Is there a way to do this with theming or something like that, so th
Solution 1:
if (isTablet(getApplicationContext())) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
setContentView(R.layout.yourlayout);
**//this method for check having run in tablet or not??**
public static boolean isTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK)
>= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
Solution 2:
Landscape does not mean this is tablet. You should put isTablet
for tables in XML file stored in res/values-sw600dp
instead.
Solution 3:
You should use android:screenOrientation="landscape"
in Manifest
file where you define your activities
<activity
android:name="com.yourpackage.ActivityClassName"
android:label="@string/app_name"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Solution 4:
I think you just need to add screenOrientation
in your activity tag
in manifest.xml
as below :
<activity>
android:screenOrientation="landscape"
</activity>
And you application will open in landscape
mode
Solution 5:
add below line in your manifest under activity tag...
android:screenOrientation="landscape"
Post a Comment for "Force Tablet To Be In Landscape Mode"