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
You are setting your picture in background, and the
android:backgroundtag uses 9 patch images. So your background always stretches to the width and height of the view. Your layout width is set tofill_parent, so the image width isfill_parenttoo.The solution could be to make a 9 patch image of the png you are using with
.9.pngextension.Read here for drawing 9 patch images – developer.android.com/guide/developing/tools/draw9patch.html