Application does not use full screen

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Application does not use full screen

Postby Solvek » Wed Dec 09, 2009 5:38 pm

I expected my app to occupy whole screen but I have terrible black zone in the bottom.

This problem is for WQVGA432 mode.

Layout is defined like this:

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/mainLayout"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:orientation="vertical" android:background="@drawable/backrepeat">
   ....
</LinearLayout>


in activity i have code

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         requestWindowFeature(Window.FEATURE_NO_TITLE);
  2.         getWindow().setFlags(
  3.                         WindowManager.LayoutParams.FLAG_FULLSCREEN,  
  4.                         WindowManager.LayoutParams.FLAG_FULLSCREEN);
  5.        
  6.         setContentView(R.layout.main);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Here is my manifest

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.solvek.twisdial.android"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name" android:description="@string/app_description">
        <activity
           android:name=".Twisdial"
           android:label="@string/app_name"
           [b]android:screenOrientation="portrait"[/b]>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
    <uses-sdk android:minSdkVersion="2" />

   <uses-permission android:name="android.permission.INTERNET" />
   <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
   <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
   <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
</manifest>


Another problem: I want to display my app always in portrait mode. However if system orientation is landscape - my app is not rotated but I added android:screenOrientation="portrait"
Solvek
Freshman
Freshman
 
Posts: 6
Joined: Wed Dec 09, 2009 5:09 pm

Top

Postby Solvek » Wed Dec 09, 2009 5:39 pm

Here is screenshot
Image
Solvek
Freshman
Freshman
 
Posts: 6
Joined: Wed Dec 09, 2009 5:09 pm

Postby achie1266 » Wed Dec 09, 2009 5:53 pm

try android:layout_weight = 1.0
or
also see if removing the background changes the view to occupy the full screen.

I never used the layout from java code. so i can't comment on that yet.
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Postby qlimax » Wed Dec 09, 2009 6:35 pm

Code: Select all
setContentView

must be called after all that:

Code: Select all
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN, 
WindowManager.LayoutParams.FLAG_FULLSCREEN);


maybe that's the problem... :roll:

another advice is to use

Code: Select all
<application android:icon="@drawable/icon"   ....... android:theme="@android:style/Theme.NoTitleBar">


This is preferable because it tells the system not to show a title bar while your application is starting up. With the explicit method call, your application will have a title bar visible to the user until onCreate runs.
This can be applied to either the <application> tag or to individual <activity> tags.


bye ;)
¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Postby qlimax » Sat Dec 12, 2009 10:06 pm

seems that you solved your problem...
:?
twisdial_-_a_spinner_for_twister-t9562.html
¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Postby zorro » Wed Jan 06, 2010 10:25 am

On WQVGA the screen ratio is different from that of default android screen (G1 = 320x480).
So your application gets scaled by android to best fit without streching your layout (based on the width of the screen), and that gives a little black portion at the bottom. If android scaled your app to fit nicely on a vertical basis, your app would exit the screen in the right, so it would have been worse.
User avatar
zorro
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Mon Aug 10, 2009 3:11 pm
Location: Romania

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Google [Bot] and 6 guests