Search code examples
androidxmlheadernine-patch

Header android 9patch


I would like to create a full screen header for Android. I created the image that is 70 * 480 px (& 9patch). how can I do? I tried using the galaxy tab .. but it does not fill the screen horizontally. This is the code:

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:foo="http://schemas.android.com/apk/res/aaa.bbb"
    android:id="@+id/db1_root" 
    android:orientation="vertical"  
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:background="@drawable/background">
 <ImageView 
                android:src="@drawable/header" 
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="top"
                    >
</ImageView>

thanks in advance.


Solution

  • You need to set the android:scaleType and optionally android:adjustViewBounds. Play around with these two attributes to get the desired effect.

    http://developer.android.com/reference/android/widget/ImageView.html#attr_android:scaleType