0

I need help with a custom button in Android. I want to make a button which exists of three components: a left border, a right border and the center.

Left border image Center image Right border image

If the button is stretched horizontally, the right and left borders must stay intact, and the center must be stretched.

I tried to make it using the Android GUI editor in Eclipse, but it didn't succeed. Now is there a way to achieve this? If yes, how? Do I need to use an ImageButton or a Button?

MC Emperor
  • 22,334
  • 15
  • 80
  • 130

2 Answers2

1

It is called nine patch or 9patch.
Here is the official documentation and here also.
And there is a simple tool to create 9patch made by Roman Nurik.

Simon Marquis
  • 7,248
  • 1
  • 28
  • 43
0

// Use Android asset Studio for generate 9 patch image.

// Under Stretch region you can select stretchable area

http://romannurik.github.io/AndroidAssetStudio/nine-patches.html

Pawan Yadav
  • 1,772
  • 19
  • 17