【发布时间】:2011-09-29 06:28:02
【问题描述】:
我调用setCompoundDrawables方法后,复合Drawable没有显示出来..
Drawable myDrawable = getResources().getDrawable(R.drawable.btn);
btn.setCompoundDrawables(myDrawable, null, null, null);
有什么想法吗?
【问题讨论】:
-
如以下答案所述,需要调用名为
(..)WithIntrinsicBounds的方法的变体。附带说明一下,Compound Drawable 的padding必须在之后设置此调用以产生效果 -
document 说:Drawables 必须已经调用了
setBounds(Rect)。 -
嗨,hunterp,刚刚在咖啡店 (Angel) 认识你,现在我知道你知道 Android Drawable 是什么了(也许你在使用它们中的许多错误时已经因为错误错误而记错了) ,我可以告诉你一些我合作过的项目不得不处理这个问题,看看毕加索(github.com/square/picasso)使用的github.com/JakeWharton/DiskLruCache(我合作使Android更友好)
-
@Dr1Ku 其实我以前有过,反正也可以用。
标签: android android-layout android-drawable