How to add a image inside a edit text android [duplicate]

左心房为你撑大大i 提交于 2020-01-15 16:48:40

问题


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

回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/24902771/how-to-add-a-image-inside-a-edit-text-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!