Andy
Andy

Reputation: 21

Getting my android apps to scale to larger screen

I've tried over and over again to get my app to scale to larger screens (like my new sensation, and my galaxy tab).

No matter what I do to my .xml layout files, the app shows up like it's on a small screen (black open space around the app).

Is there anyway to just make my app stretch to fit the screen without rewriting all my layouts, or providing new images? I realize I may get some blur, but I'm ok with that for now.

Thanks!

Upvotes: 2

Views: 5552

Answers (5)

GalkinAndrew
GalkinAndrew

Reputation: 66

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
...
    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10" />
...
</manifest>

It solved my problem.

Upvotes: 0

Andreas Rudolph
Andreas Rudolph

Reputation: 1246

I created a tool that allows you to scale/adjust your layouts for tablets and small screen devices and made a blog post about it here: http://onemanmobile.blogspot.com/2012/04/how-to-scale-your-android-layouts-to.html

Basically, defining your layouts in dp units is not enough if you want your app to fit on all devices and tablets, since there's four different "density-buckets". This tool will allow your layouts to be converted into fitting these density buckets.

I hope the blog, tool and answer will help others, I know it felt good to have my app work on a tablet with the press of a button.

Upvotes: 0

Belurd
Belurd

Reputation: 782

You have to put

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

to your manifest file. Version of api earlier 1.5 doesn`t supports streching of the screen and on the big-size screens it will remains small with black space around.

Upvotes: 0

funcoder
funcoder

Reputation: 1975

There are several ways.

That what you need is the Android Screen Compatibility Mode. In your case you have to add the following in your Manifest file:

<supports-screens android:xlargeScreens="true" />

This declares that your application supports all larger screen sizes.That has the effect that the system will always resize your layout to fit the screen.

In general is it important that you do not use an Absolute-Layout. You should use for different screen resolutions, different folders for graphics and if necessary different .xml layout files.

That could like as follows:

res/layout-small/my_layout.xml       // layout for small screen size
res/layout-large/my_layout.xml       // layout for large screen size
res/layout-xlarge/my_layout.xml      // layout for extra large screen size

res/drawable-mdpi/my_icon.png        // bitmap for medium density
res/drawable-hdpi/my_icon.png        // bitmap for high density
res/drawable-xhdpi/my_icon.png       // bitmap for extra high density

You should use wrap_content, fill_parent, or dp units when specifying dimensions in an XML layout file.

Upvotes: 2

Jan
Jan

Reputation: 208

make sure to include this in your android manifest xml:

<uses-sdk 
    android:targetSdkVersion=x 
    android:minSdkVersion=y>
</uses-sdk>

where x is the target sdk version and y is the minSdkVersion.

Upvotes: 2

Related Questions