How to add a image inside a edit text android [dup

2019-08-07 10:47发布

This question already has an answer here:

I want to add image inside edittext view . For example i have image that size is 250*250 i want to show text left to image for height of 250 after that have to show text in normal left position.

               Some text some text some text
  Some image   Some text some text some text
               Some text some text some text
Some text some text some text Some text some 
text some text some text some text Some text 
some text Some text some text Some text some

2条回答
Fickle 薄情
2楼-- · 2019-08-07 11:04

You can add image in editext programmatically using setCompoundDrawableWithinBounds set drawable at left...

查看更多
在下西门庆
3楼-- · 2019-08-07 11:14

You can use the xml property android:drawableLeft or (as mentioned) setCompoundDrawableWithinBounds. But your EditText will look something like this:

enter image description here

查看更多
登录 后发表回答