Android: making a fullscreen application

后端 未结 13 1773
北恋
北恋 2020-11-30 00:31

What is the simplest change that I can make to a new Blank Activity, as created by the latest version of Android Studio, to get the app to appear fullscreen?

I want

相关标签:
13条回答
  • 2020-11-30 00:59

    you can do make App in FullScreen Mode form just one line code. i am using this in my code.

    just set AppTheme -> Theme.AppCompat.Light.NoActionBar in your style.xml

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    

    It will work in all pages..

    0 讨论(0)
  • 2020-11-30 01:00

    Just add the following attribute to your current theme:

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

    For example:

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/orange</item>
        <item name="colorPrimaryDark">@android:color/holo_orange_dark</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>
    </style>
    
    0 讨论(0)
  • 2020-11-30 01:02

    just do this in your manifest file in your activity tag

    android:theme="@style/Theme.AppCompat.Light.NoActionBar"
    
    0 讨论(0)
  • 2020-11-30 01:06

    Simply declare in styles.xml

      <style name="AppTheme.Fullscreen" parent="AppTheme">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>
      </style>
    

    Then use in menifest.xml

        <activity
            android:name=".activities.Splash"
            android:theme="@style/AppTheme.Fullscreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
    
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    

    Chill Pill :)

    0 讨论(0)
  • 2020-11-30 01:06

    I recently had the exact same issue and benefitted from the following post as well (in addition to Rohit5k2's solution above):

    https://bsgconsultancy.wordpress.com/2015/09/13/convert-any-website-into-android-application-by-using-android-studio/

    In Step 3, MainActivity extends Activity instead of ActionBarActivity (as Rohit5k2 mentioned). Putting the NoTitleBar and Fullscreen theme elements into the correct places in the AndroidManifest.xml file is also very important (take a look at Step 4).

    0 讨论(0)
  • 2020-11-30 01:10

    In onCreate call

    requestWindowFeature(Window.FEATURE_NO_TITLE); // for hiding title
    
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    
    0 讨论(0)
提交回复
热议问题