如何为提示添加一个图标图像编辑框在Android中 [英] How to add an icon image as hint to EditBox in Android

查看:147
本文介绍了如何为提示添加一个图标图像编辑框在Android中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要把搜索图像镜头一丝的EditText。是有可能做到这一点在Android的?

I need to put the search image lens as hint in EditText. is it possible to do it in Android?

最好的问候,,

推荐答案

我总是通过改变绘制正确的解决了这个。

I always have solved this by changing the drawable right.

您可以做它的布局xml文件的android href="http://developer.android.com/reference/android/widget/TextView.html#setCompoundDrawablesWithIntrinsicBounds%28int,%20int,%20int,%20int%29">setCompoundDrawablesWithIntrinsicBounds功能。

You can do it on the layout xml file android:drawableRight="@drawable/search_icon" or programmatically using the setCompoundDrawablesWithIntrinsicBounds function.

希望它帮助! :)

这篇关于如何为提示添加一个图标图像编辑框在Android中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆