hakim
hakim

Reputation: 3909

android 9-patch image working properly on layout design but didn't work on device

I use 9-patch image for button's background, it is working on layout design (eclipse) but not working when application running on device, here the 9-patch image:

button background

and the layout:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="0dp"
    android:orientation="horizontal"
    android:padding="0dp" >

    <Button
        android:id="@+id/toggle_subscribed_thread"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="@drawable/background_silver"
        android:focusable="true"
        android:padding="0dip"
        android:text="Thread" >

        <requestFocus />
    </Button>

    <Button
        android:id="@+id/toggle_subscribed_forum"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:padding="0dip"
        android:background="@drawable/background_silver"
        android:text="Forum" />

    <Button
        android:id="@+id/toggle_subscribed_classified"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:padding="0dip"
        android:background="@drawable/background_silver"
        android:text="Classified" />
</LinearLayout>

in layout design (eclipse) it appear like this:

enter image description here

but, when the app is executed on android device it appear like this:

enter image description here

any idea, why how to solve this issue ?

thank you.

Upvotes: 1

Views: 861

Answers (1)

dipali
dipali

Reputation: 11188

enter image description here

Use this image.

<Button
        android:id="@+id/toggle_subscribed_forum"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/background_silver"
        android:text="Forum" />

Upvotes: 1

Related Questions