布局
//代码
Drawable drawable = mcontext.getResources().getDrawable(R.mipmap.ic_launcher);
text.setCompoundDrawablesWithIntrinsicBounds(null,drawable,null,null);
本文介绍了如何在布局中使用Drawable资源设置图片。通过获取上下文的资源并使用getDrawable方法加载图片资源,然后利用setCompoundDrawablesWithIntrinsicBounds方法将图片设置到文本视图上。
布局
//代码
Drawable drawable = mcontext.getResources().getDrawable(R.mipmap.ic_launcher);
text.setCompoundDrawablesWithIntrinsicBounds(null,drawable,null,null);

被折叠的 条评论
为什么被折叠?