开发者

What's wrong with my 9-patch PNG for Button

I created a 9-patch PNG but it won't work. In the Android SDK Tool everything looks ok. But when i add it to a Button then i only see a pink background. The text placement (padding from the patch) seems to be ok. What 开发者_StackOverflow中文版am i doing wrong?

     <Button 
    android:id="@+id/button_settings"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:focusable="true"
    android:text="Settings"
    android:textColor="#fff"
    android:background="@drawable/button_settings_idle"
/>

The 9-patch in the Android SDK Tool:

What's wrong with my 9-patch PNG for Button

A normal Button and the Button with the PNG:

What's wrong with my 9-patch PNG for Button

The PNG used in my project

What's wrong with my 9-patch PNG for Button


Paint your background image like a rainbow (diagonal gradient is the best), you will then see which part of image overlaps which and possibly why.

My guess: trim your picture horizontally (remove the middle part and make 9patch do it's job) then see what happens. If background picture is bigger than actual button, strange things happen - like overlapping "text area" over "fixed" image parts.


maybe, you should draw between two points on top and left.

You can try to shift to the right point to left to imageWidth for content??

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜