Home » Android » android – How to make my app full screen on Galaxy Tab

android – How to make my app full screen on Galaxy Tab

Posted by: admin June 15, 2020 Leave a comment

Questions:

I’ve been trying everything I can think of to get my app to display full screen on the Galaxy Tab.

Basically, it works like the Lunar Lander example app that comes with the Android SDK. What would you do to make that Lunar Lander app display in full screen on Large screen devices like the Galaxy Tab?

I’m not concerned about the quality of the graphics at this point, but just how an app created like this can fill the screen. It was basically designed to work on a 320×480 MDPI screen with images in the drawable folder and it uses a SurfaceHolder and view to draw the individual bitmaps.

Any advice?

CLARIFICATION: Sorry, I don’t mean full screen as in removing the notification and title bar, I mean that everything has a giant black border around it and it the graphics don’t take up the whole screen.

How to&Answers:

If you set your target sdk level to anything less than 9, then support for extra-large screens is assumed to be false. If you set targetSdkVersion=9 in the manifest, then xlarge support is assumed to be true. See the documentation on Supporting Multiple Screens, in particular the description of compatibility mode.

Answer:

another way to do is creating a xml called styles.xml in res/values

define a style:

<style name="Theme.FullScreen" parent="android:Theme">
        <item name="android:windowFullscreen">true</item>
        <item name="android:windowNoTitle">true</item>
    </style>

later in the manifest, tell android what activity must be in fullscreen setting the style above:

<activity android:name=".activity.NewSearchBrowserActivity" android:theme="@style/Theme.FullScreen" android:screenOrientation="landscape"></activity>

in this way you make a reusable theme what can be applied to any activity.

Answer:

Ted mentioned XLargeSceens, the Galaxy Tab is running 2.2 and therefore doesn’t have the xlargeScreens attribute as it was added in 2.3; Because the upcoming generation of tablets will have 3.0 and XlargeScreens you are going to want to use it anyway (and compile against 2.3/3.0)

In your Manifest you need to declare support for all reasonable screen sizes and provide the correct set of resources

<supports-screens 
    android:smallScreens="false" 
    android:largeScreens="true"
    android:xlargeScreens="true"  
    android:normalScreens="true" 
    android:anyDensity="true"
/>

Answer:

Unless you support SDK versions that are at least 4, i.e.:
<uses-sdk android:minSdkVersion="4"/>,

you will have to do the following explicitly:

<supports-screens android:smallScreens="true"
    android:normalScreens="true"
    android:largeScreens="true"
    android:anyDensity="true" />

Answer:

 public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

This is working fine for me… try this

Answer:

<uses-sdk android:minSdkVersion="4" />

or an other version number is missing in your manifest

Answer:

you can add this exactly under

  super.onCreate(savedInstanceState);

of the activity you want to be full screen.

 requestWindowFeature(Window.FEATURE_NO_TITLE);
 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
            WindowManager.LayoutParams.FLAG_FULLSCREEN);  

Answer:

Give this one in your manifest file:

<supports-screens android:smallScreens="true"
    android:normalScreens="true"
    android:largeScreens="true"
    android:anyDensity="true" />

Surely it will work.