Search code examples
androidandroid-layoutnine-patch

9-Patch Button not showing text


I have a 9-patch button with a right drawable and text assigned to the button, when i use a normal image it shows the text, when i use a colour it shows the text, however when i use a 9-patch image it does not show the image.

Here is the code + image;

<Button 
        android:id="@+id/btn_active_timer"
        android:layout_width="300.00dp"
        android:layout_height="38.00dp"
        android:layout_marginLeft="10.00dp"
        android:layout_above="@+id/gui_menu_container"
        android:layout_marginBottom="6.00dp"
        android:background="@drawable/ui_black"

        android:drawableRight="@drawable/ui_arrow_small"
        android:text="Whats the time mr woolf?"
        android:textColor="#FFFFFF"
        android:textSize="15.00dp"
        android:gravity="left|center_vertical"
     />

enter image description here


Solution

  • Look at the padding areas of your 9-patch - they are 1px in size - there can't be any text on this 1 px. My guess is, you confused the padding and stretching areas. Try replacing top/left with bottom/right.