Reputation: 26351
I'm using such layout:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/logo"
android:orientation="horizontal" >
The drawable/logo.xml
:
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/login_logo"
android:gravity="center" />
The drawable/login_logo.png
has 280 pixels width, my Galaxy Tab screen width is 600px but in launched app I see the image takes almost all screen width and it is about 500px
Where did I make mistake?
SOLVED
By setting
<uses-sdk android:minSdkVersion="4" />
and putting image to drawable-hdpi
Upvotes: 1
Views: 92
Reputation: 18509
Upvotes: 2
Reputation: 20368
You are setting your picture in background, and the android:background
tag uses 9 patch images. So your background always stretches to the width and height of the view. Your layout width is set to fill_parent
, so the image width is fill_parent
too.
The solution could be to make a 9 patch image of the png you are using with .9.png
extension.
Read here for drawing 9 patch images - developer.android.com/guide/developing/tools/draw9patch.html
Upvotes: 1
Reputation: 104196
I suggest that you have a good read of the documentation. If you have placed your image in the drawable-mdpi folder, then in high density screens the image will appear to be 1.5x in size. You will have to provide different resolutions of your image for different screen densities.
Upvotes: 1