Adding text to ImageView in Android

后端 未结 9 1616
北荒
北荒 2020-12-02 16:44

I want to use an ImageView to show some message in a fancy way.

How do I add text to an ImageView?

9条回答
  •  执笔经年
    2020-12-02 17:10

    I know this question has been and gone, but if anyone else stumbled across this I wanted to let them know. This may sound an unintuitive thing to do but you could use a button with clickable set to false or what ever. This is because a button allows one to set drawableLeft, drawableRight, drawableTop etc in addition to text.

      

    New Info: A button can have icons in drawableLeft, drawableRight, drawableTop, and drawableBottom. This makes a standard button much more flexible than an image button. The left, right, top etc is the relation to the text in the button. You can have multiple drawables on the button for example one left, one right and the text in the middle.

提交回复
热议问题