进来给分了。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大小就不对。 再问 android framebuffer 新手异常问题android 模拟器 setting进不去 android和window phone 7 SurfaceView背景闪烁问题 求工具和初级教程。 多个ImageView 的 setOnTouchListener或setOnClickListener 不起作用 实现图中效果需要什么控件??? android开发前景怎样 联系人信息获取排序问题【#A-Z】 Android下的UDP传输协议问题 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大小就不对。