Search code examples
fluttersmart-tv

Can Android TV display portrait? (flutter)


Is it possible to make an application on Android TV but the display must be portrait according to the size of the TV, using the Flutter programming language

Example AndroidManifest.xml

``` 
<activity
   android:name=".MainActivity"
   android:exported="true"
   android:launchMode="singleTop"
   android:theme="@style/LaunchTheme"
   android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
   android:hardwareAccelerated="true"
   android:windowSoftInputMode="adjustResize"
   android:screenOrientation="portrait">
```

Results: enter image description here

Thank you very much


Solution

  • we get the idea of the position we rotate

    Example AndroidManifest.xml

    <activity
       android:name=".MainActivity"
       android:exported="true"
       android:launchMode="singleTop"
       android:theme="@style/LaunchTheme"
       android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
       android:hardwareAccelerated="true"
       android:windowSoftInputMode="adjustResize">
    

    Example page.dart

    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: Center(
          child: RotatedBox(
            quarterTurns: 3,
            child: Container(
              padding: const EdgeInsets.all(8.0),
              color: const Color(0xFFE8581C),
              child: const Text('data'),
            ),
          ),
        )
      );
    }
    

    Results enter image description here