Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android 9-patch graphic doesn't scale in image view

I have

<LinearLayout android:id="@+id/LinearLayout01"
    android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:orientation="horizontal">
    <ImageView android:layout_height="wrap_content"
        android:layout_width="wrap_content" android:id="@+id/ImageView01"
        android:src="@drawable/phone80"></ImageView>
    <ImageView android:id="@+id/ImageView02"
        android:layout_height="wrap_content" android:src="@drawable/underline"
        android:layout_width="fill_parent" android:layout_gravity="fill_vertical|fill_horizontal"></ImageView>
</LinearLayout>

The first image is a fixed size image which shouldn't scale at all. The image right of it should scale horizontally to the maximum space. The source points to a valid .9.png file. Unfortunatly it always only shows up in its original size. What property to I have to set? Is ImageView the right object at all?

Thanks, A.

like image 657
AndyAndroid Avatar asked Mar 09 '11 08:03

AndyAndroid


1 Answers

Just add android:scaleType="fitXY" to your ImageView. For example for myimage.9.png:

<ImageView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:src="@drawable/myimage"
    android:scaleType="fitXY" />
like image 101
ashakirov Avatar answered Sep 24 '22 16:09

ashakirov