0

I want to design a button which looks like:

Picture on dropbox

(Sorry, can't yet post images...)

Has anybody an idea how to layout? Use Buttons or TextViews? Is there an option to group 2 TextViews?

Thank you :)

Jonas
  • 1,432
  • 3
  • 20
  • 27

1 Answers1

0

You create a layout and populate it as you want it to appear in your button, generate a bitmap image of the layout, and set that bitmap as the image in an ImageButton.

There are plenty of layout tutorials around.

There are examples of how to do the bitmap conversion:

Get bitmap from layout

http://www.brighthub.com/mobile/google-android/articles/30676.aspx

For the image button:

http://www.mkyong.com/android/android-imagebutton-example/

Although this uses a resource drawable. You just call setImageBitmap instead. See:

http://developer.android.com/reference/android/widget/ImageView.html

I can provide an example later tonight when I am at my pc.

Community
  • 1
  • 1
  • isn't there a way wihtout images... that the layout stays dynamic and e.g. the darker part at the bottom grows with a bigger textsize without influencing the rest of the button? – Jonas Mar 21 '13 at 14:47
  • You can create a layout and make the layout itself clickable and act like a button. If there is any other way, I'm not aware of it although I am a fairly new user of Android myself. – confused_at_times Mar 21 '13 at 14:56