user568306
user568306

Reputation: 1

Android ImageButton / Custom-Button?

I am new to android development. So far I could help myself in all matters by reading threads here on stackoverflow. Now I am stuck and need someones help. Unfortunately I am not allowed to post an image of a screenshot because I am a new mamber, so I try to descripe it.

I have a Samsung Galasy S and the clock app that ships with it has an button called "+ Create alarm". I want to create a similar button for my app. I've been experimenting with ImageButton. I do know how to get that "+"-Icon onto an ImageButton, but only centered and without text. I guess this is a custom button. Does anyone know how to do this? Can I do it in xml or do I need to extend the view-class and make it my own view?

Upvotes: 0

Views: 1798

Answers (2)

Vit Khudenko
Vit Khudenko

Reputation: 28418

You can do this via xml only. There's an example. Most likely you already do smth similar. But my advice is to create your custom image (which you will display on the ImageButton) so that image includes both your icon and the text label. However looks like CommonsWare proposes a better approach.

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1006744

In the future, if you want us to help you make something look like something else, it would help to have an image. Use the screenshot capability of DDMS to record what it is you want something to look like, and include the image in your question.

A regular Button can have an image to any side of the text, via the android:drawableBottom, android:drawableLeft, etc. attributes.

Upvotes: 1

Related Questions