1 year ago

#367926

test-img

Alex Advent

Screen get abnormal when I rotate screen using java on Android TV api 29

I am rotating the screen from landscape to portrait but the screen works abnormally when I do this. The screen size gets small.

The app is working fine in android API version 23 but with 29 this issue is occurring.

here is my code:

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);

Before Rotation enter image description here

After Rotation enter image description here

Here is my XML file I am using this app on android tv

<?xml version="1.0" encoding="utf-8"?>

<uses-feature
    android:name="android.software.leanback"
    android:required="false" />
<uses-feature
    android:name="android.hardware.touchscreen"
    android:required="false" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<application
    android:allowBackup="true"
    android:banner="@mipmap/ic_banner"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="false"
    android:theme="@style/AppTheme.NoActionBar">
    <activity
        android:name=".ServerActivity"
        android:exported="false" />

    <receiver
        android:name=".yourActivityRunOnStartup"
        android:enabled="true"
        android:exported="true"
        android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="android.intent.action.QUICKBOOT_POWERON" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </receiver>

    <activity
        android:name=".yourActivityRunOnStartup"
        android:exported="false" />
    <activity
        android:name=".InternetActivity"
        android:configChanges="orientation|screenSize|keyboardHidden"
        android:exported="false"
        android:screenOrientation="landscape" />
    <activity
        android:name=".DownloadActivity"
        android:configChanges="orientation|screenSize|keyboardHidden"
        android:exported="false"
        android:screenOrientation="landscape"/>
    <activity
        android:name=".DisplayActivity"
        android:exported="false"/>
    <!--            android:configChanges="orientation|screenSize|keyboardHidden"-->

    <activity
        android:name=".PinActivity"
        android:configChanges="orientation|screenSize|keyboardHidden"
        android:exported="false"
        android:screenOrientation="landscape" />
    <activity
        android:name=".MainActivity"
        android:configChanges="orientation|screenSize|keyboardHidden"
        android:exported="true"
        android:screenOrientation="landscape"
        android:theme="@style/Theme.AppCompat.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    <meta-data
        android:name="preloaded_fonts"
        android:resource="@array/preloaded_fonts" />
</application>

java

android

android-studio

android-tv

screen-rotation

0 Answers

Your Answer

Accepted video resources