Search code examples
androidnine-patch

What's wrong with this ninepatch image?


I cannot understand, why this 9patch image is not being set as ninepatch in my android app. For some reason, it's showing it as a regular png file.

Weird thing is, both the draw9patch tool and the Eclipse build in UI designer, show the image correctly (it's being expanded correctly), but not on the nexus 7.

I'm attaching the image.

Google+ button 9patch

It's not the filename, as the 9patch was created with the draw9patch tool and the filename is "google_button.9.png"

This is the XML code

<Button
            android:id="@+id/btn_googleplus"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:background="@drawable/google_button"
            android:minWidth="300dp"
            android:text="@string/login_login_with_google"
            android:textColor="#ffffffff"
            android:textStyle="bold"
            android:textSize="19sp"
            android:layout_marginTop="15dp"/>

Solution

  • It seems the 9-patch wasn't ok, I simplified to this one. Please, give it a try. When I use 9-patches, I only put top and left edges marks; I guess putting marks all around the png was causing the mess at some point.

    9-patch image updated