【发布时间】:2013-07-24 07:09:57
【问题描述】:
我知道在Android中我们可以使用函数setCompoundDrawables(..)来添加drawable。
我的问题是我的 EditText 是多行的,我想将 drawable 放在 EditText 的左上角。但是使用 setCompoundDrawables() 函数,只能选择将drawable放在特定的一侧。
Android API 有可能做到吗?
【问题讨论】:
-
你可以像这样用
setCompoundDrawablesWithIntrinsicBounds()替换setCompoundDrawables(..)->EditTextId.setCompoundDrawablesWithIntrinsicBounds(0, myIcon, 0, 0); -
我可以在 myIcon 中添加什么值?我知道那是 int.. 我可以在哪些值之间选择?
-
myIcon只是一个示例,但是您可以像在setCompoundDrawables(..)方法中所做的那样输入相同的内容,如果您粘贴获得的代码,我可以帮助您。 :) -
我找到了。 int = drawble id。
标签: android android-edittext drawable