tags:

views:

49

answers:

1

In my Android project, I've a image button whose background is set to some image. I want so set some text on the image button. How do i do that/

I want to set the text because localization would be used in the project....

+1  A: 

An ImageButton is not supposed to have text, that's why it's called ImageButton.

Try to use Button, which inherits from TextView and does have the android:text attribute.

<Button     
    android:id="@+id/btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"

    android:text="mail"

    android:background="@drawable/btn_selector"/>

Is there any particular reason why you want to use ImageButton over Button?

Maragues