Namenlos
Namenlos

Reputation: 1615

Layout problems with 9-patch background image

I have a 9-patch background image for my layout and it works fine when the display resoluton is smaller then the image (800x480px). But when I test it on a device with a bigger resoluton, for example 1280x800px, than the layout is broken. Here are two pictures:

The normal and broken layout

The 9-patch image

Here is the relevant layout-code:

<LinearLayout
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/chalkboard"
android:gravity="top|center"
android:orientation="vertical" >

All in all, the 9-patch doesn't work when the image scales up. But what's the reason and how can I handle it?

Best regards!

Upvotes: 1

Views: 1240

Answers (1)

Ahmad
Ahmad

Reputation: 72533

You are stretching the frame as well. Just don't stretch the frames on the side. This should do the work: enter image description here

Upvotes: 2

Related Questions