1

I need to create a button that looks like this:

button I was hoping to create it without using images. To create the pink part, I wanted to use a drawable.

How can I include a shape drawable within a button?

jekie
  • 441
  • 4
  • 10
  • [This link][1] will help you. May not be the exact answer but it will be a help. [1]: http://stackoverflow.com/questions/7482364/how-to-custom-button-has-two-textfields-on-android – Nithin Michael Dec 04 '13 at 17:21
  • please accept or upvote one of the answers, if it was of any help to you. See http://meta.stackexchange.com/q/5234 or if you have any further queries please ask. – DroidDev Dec 05 '13 at 07:41
  • Nitin, that article was very helpful, thanks. – jekie Dec 05 '13 at 15:12

2 Answers2

1

You can create a Layout, set background color for that layout as you wish. In that layout add two textviews. Set background for one layout pink. add another under the first textview. Then you can set onClickListener on layout. It'll work same as that of button and it'll be easy to change colors and text programatically.

DroidDev
  • 1,527
  • 4
  • 20
  • 42
0

Try using an ImageButton and setting android:src to point to your ShapeDrawable resource.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491