android 使用java 代码设置 textview的图片
2016-07-25 10:09
537 查看
Drawable drawable = getResources().getDrawable(R.drawable.icon);
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
text.setCompoundDrawables(drawable, null, null, null);
text.setCompoundDrawablePadding(10);
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
text.setCompoundDrawables(drawable, null, null, null);
text.setCompoundDrawablePadding(10);
相关文章推荐
- android SpannableString使用详解
- android gradle assembleRelease 的时候报java.lang.OutOfMemoryError: GC overhead limit exceeded”
- 笔记——Android 中的小细节
- Android获取摄像头支持的分辨率
- android 文件读取(assets)
- Android Studio中格式化代码
- android图片缓存
- Android View 仿iOS7 底部弹出框
- ListView嵌套GridView使用详解及注意事项
- 给RecyclerView 添加HeadView
- android listView嵌套gridview的使用心得
- 还在繁琐的敲MVP接口和实现类吗,教你一秒搞定。
- Android自定义View 简单实现多图片选择控件
- Error retrieving parent for item: No resource found that matches the given name 'android:W
- Android_AlarmManager(全局定时器)
- Android学习日记(yzy):Fragment与VierPager简单实现
- Android图像处理—xfermode
- Android Studio 2.0下创建jni应用调用本地C函数(转)
- Gson的使用方法
- Android apk重签名