Reputation: 6114
Trying to set orientation to Portrait
only by default. To make it so, I've added:
android:configChanges="orientation"
android:screenOrientation="portrait"
However, the app auto rotates to Landscape
mode when tilted. Furthermore, the app turns to Landscape
mode when tilted even when the orientation is locked to portrait only in phone Settings
.
Here is the Manifest.xml
file :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.browser.codedady">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<!-- Browser Main Tab -->
<activity
android:name=".Activity_Main"
android:configChanges="orientation"
android:screenOrientation="portrait"
android:label="@string/app_name"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="readLater" />
<action android:name="bookmarks" />
<action android:name="history" />
<action android:name="pass" />
</intent-filter>
<intent-filter
android:icon="@mipmap/ic_launcher"
android:label="@string/app_websearch">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>
<!-- Other activities -->
<activity
android:name=".about.About_activity"
android:configChanges="orientation|screenSize"
android:launchMode="singleInstance" />
<activity
android:name=".helper.Activity_intro"
android:configChanges="orientation|screenSize"
android:launchMode="singleInstance" />
<activity
android:name=".helper.Activity_settings"
android:configChanges="orientation|screenSize"
android:launchMode="singleInstance" />
<activity
android:name=".helper.Activity_settings_app"
android:configChanges="orientation|screenSize"
android:launchMode="singleInstance" />
<activity
android:name=".helper.Activity_settings_data"
android:configChanges="orientation|screenSize"
android:launchMode="singleInstance" />
<activity
android:name=".helper.Activity_settings_searchMain"
android:configChanges="orientation|screenSize"
android:launchMode="singleInstance" />
<activity
android:name=".helper.Activity_settings_close"
android:configChanges="orientation|screenSize"
android:launchMode="singleInstance" />
<activity
android:name=".helper.Activity_settings_start"
android:configChanges="orientation|screenSize"
android:launchMode="singleInstance" />
<activity
android:name=".helper.Activity_settings_search"
android:configChanges="orientation|screenSize"
android:launchMode="singleInstance" />
<!-- Intents -->
<activity
android:name=".helper.Activity_intent"
android:label="@string/app_name"
android:noHistory="true"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="android.intent.action.VIEW" />
<data android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
</activity>
<!-- More stuff -->
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.browser.codedady.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
<activity
android:name=".Home"
android:label="@string/title_activity_home"
android:theme="@style/AppTheme" />
</application>
</manifest>
What could possibly be causing this and how to fix this issue?
Upvotes: 1
Views: 49
Reputation: 41
Add screenOrientation = "portrait" to each activity, like so:
<activity
android:name=".MainActivity"
android:screenOrientation="portrait" />
Make sure your Java code does not alter the activity's orientation by accident. Configchanges doesn't set it to default, it asks the Java to be in charge of setting it. Remove those if they don't do anything else. See android docs here (search for "android:configChanges")
Upvotes: 1