Full Screen in customize theme

后端 未结 5 1349
慢半拍i
慢半拍i 2020-12-29 20:06

I need my app to show as full screen. Now I know how to add this feature into the application tag in Mainfest using

android:theme=”@android:style/Theme.NoTit         


        
相关标签:
5条回答
  • 2020-12-29 20:41

    Create your custom theme by using default theme, like this

    window with Fullscreen

    <style name="generalnotitle" parent="general">
        <item name="android:windowFullscreen">true</item>
    </style>
    

    window with NoTitle

    <style name="generalnotitle" parent="general">
        <item name="android:windowNoTitle">true</item>
    </style>
    
    0 讨论(0)
  • 2020-12-29 20:47

    Setting up a theme in app styles works for my React Native application. Just type in the android/app/src/main/res/values/styles.xml:

    <resources>
        <style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar.Fullscreen"></style>
    </resources>
    

    And in the android/app/src/main/AndroidManifest.xml link to this theme:

    <application
      ...
      android:theme="@style/AppTheme">
    

    Reference

    0 讨论(0)
  • 2020-12-29 20:53

    Create your custom theme with parent attribute to inherit NoTitleBar.Fullscreen property from general android theme.

    values/styles.xml

    <resources> 
       <style name="CodeFont" parent="android:Theme.NoTitleBar.Fullscreen">
          <item name="android:windowNoTitle">true</item> 
          ...
       </style>
    </resources>
    

    AndroidManifest.xml

    <activity 
        android:name=".MainActivity" 
        android:theme="@style/CodeFont"> 
          ...
    </activity>
    
    0 讨论(0)
  • 2020-12-29 21:02

    you can request some features and flags in code by using ( for example ):

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().requestFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.some_layout);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    
    0 讨论(0)
  • 2020-12-29 21:05

    in style.xml add

    <item name="android:windowFullscreen">true</item>
    

    to your theme. Example:

    <style name="CodeFont" parent="android:Theme.Light">
         <item name="android:windowFullscreen">true</item>
    </style>
    
    0 讨论(0)
提交回复
热议问题