views:

205

answers:

1

I am styling a Button whose width can change in the program through different Content. I got the png files from the designer like this:

[Left Border] [Background (just a strip with the gradient)] [Right Border]

I thought I'm fine with assigning the Properties of the Button like this:

Background: Background.png
Drawable left: LeftBorder.png
Drawable right: RightBorder.png

BUT it shall not be like that ;) Right now the Background.png begins where the Drawable Left begins and ends at the end of Drawable Right. Is using those Drawable Properties not the right way in this case?

Here is the Code:

<Button
  android:text="@+id/Button01"
  android:id="@+id/Button01"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:drawableLeft="@drawable/top_loaction_left"
  android:drawableRight="@drawable/top_loaction_right"
  android:background="@drawable/top_loaction_bg"></Button>

..

+1  A: 

What you need is a 9 patch image.

http://developer.android.com/guide/developing/tools/draw9patch.html

josnidhin
Thank u! Could u look at my Update pls?
OneWorld
Hmm... I not very sure...Let me explore
josnidhin
I moved the second question: http://stackoverflow.com/questions/3733471/android-9-patch-png-what-if-i-need-smth-like-a-11-patch-png
OneWorld