进来给分了。Android中setCompoundDrawablesWithIntrinsicBounds问题。 本帖最后由 zhoudianlong 于 2011-09-20 11:37:46 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 drawable的方法转换成int的方法?? drawable不就是通过int代表的资源图片才或得的吗?为什么要去转换?int的在资源文件里面找就可以。这个是android源代码里面google search的代码:Drawable googlePlaceholder = getContext().getResources().getDrawabl(R.drawable.placeholder_google); setCompoundDrawablesWithIntrinsicBounds(int left, int top, int right, int bottom) { final Resources resources = getContext().getResources(); setCompoundDrawablesWithIntrinsicBounds(left != 0 ? resources.getDrawable(left) : null, top != 0 ? resources.getDrawable(top) : null, right != 0 ? resources.getDrawable(right) : null, bottom != 0 ? resources.getDrawable(bottom) : null);}应该没有区别,看上面的源码就知道,整型参数的方法还是调用了drawable参数的那个方法,里面还是根据resID获取到了drawable。可能你传进去的drawable大小就不对。 Andriod.mk 链接-lasound库 Android源代码下载失败 模拟器默认网络模式是GSM,在什么地方定义的呢? 我在android.com上搜到一些博客,为什么打不开呢?是不是需要翻墙啊? QuickSearchBox代码分析问题。 gridview 行加載事件是什麽? eclipse开发后 模拟器运行 覆盖问题 寻找一android开发人员完成一个图表APP。 android4.3, 如何修改让所有应用都竖屏显示 有没有这样的短信通知平台? setLayoutParams有时会没有效果是怎么回事 android作为服务器 pc做客户端 通信
Drawable googlePlaceholder = getContext().getResources().getDrawabl(R.drawable.placeholder_google);
final Resources resources = getContext().getResources();
setCompoundDrawablesWithIntrinsicBounds(left != 0 ? resources.getDrawable(left) : null,
top != 0 ? resources.getDrawable(top) : null,
right != 0 ? resources.getDrawable(right) : null,
bottom != 0 ? resources.getDrawable(bottom) : null);
}
应该没有区别,看上面的源码就知道,整型参数的方法还是调用了drawable参数的那个方法,里面还是根据resID获取到了drawable。
可能你传进去的drawable大小就不对。