Run Android app only in Portrait or Landscape mode by setting the default orientation mode (screen orientation in Android using Android Studio): portrait or landscape for your Android application. In manifest->AndroidManifest.xml write the code (if you want portrait, you have to write portrait instead of landscape):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.app.toyo.myapplication">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity"
            android:screenOrientation="landscape">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
  Follow Video Tutorial:
  Please subscribe here to our YouTube channel. Thank you! Check next tutorials to learn all about Android. For further questions leave a message.  

Leave a Reply

Your email address will not be published. Required fields are marked *

Blue Captcha Image Refresh

*