Mats Hofman
Mats Hofman

Reputation: 7240

Ugly nine-patches, not scaling right

A made some nine-patches for my buttons in Android but they scale in an ulgy way. The weird thing is that they are only ugly in one specific Android project.

enter image description here

I have no idea what cause the nine-patch to scale bad. This is the XML used in the badly scaled project, it is the same in the good scaled project.

<Button
    android:id="@+id/issueShare"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:layout_marginLeft="5sp"
    android:layout_marginRight="5sp"
    android:background="@drawable/button"
    android:text="Delen" />

Upvotes: 1

Views: 1031

Answers (2)

Mats Hofman
Mats Hofman

Reputation: 7240

I found the solution on a place I would never look. The problem was that in my Android Manifest I didn't specify the android:targetSdkVersion, only the minSdkVersion. After setting the android:targetSdkVersion the nine-patches scaled fine.

Upvotes: 1

raukodraug
raukodraug

Reputation: 11619

I think the problem is related to the density of the phone, is the nine-path in the drawable folder only? or do you have a version of it in each of the drawable specific density folders?

Upvotes: 1

Related Questions