TextView设置drawable
2016-02-04 18:01
288 查看
代码:
Drawable drawable = getResources().getDrawable(R.mipmap.a);
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); //设置边界
tv.setCompoundDrawables(null, null, drawable, null);//画在右边
要注意的: 一定要有setBounds()这段代码,不让不会显示drabable.
Drawable drawable = getResources().getDrawable(R.mipmap.a);
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); //设置边界
tv.setCompoundDrawables(null, null, drawable, null);//画在右边
要注意的: 一定要有setBounds()这段代码,不让不会显示drabable.
相关文章推荐
- 使用R画地图数据
- JavaScript总结(二) 系统分析
- 合并svn分支到主干(linux)
- Fast Paxos 分布式算法
- 文字图标
- STM32 USB学习笔记1
- Access query 使用方法
- win7下安装ubuntu14.04双系统问题总结
- SVM: 用kernels(核函数)来定义新的features,避免使用多项式,高斯kernel
- hdu 2199 Can you solve this equation?
- Javascript中的new
- poj1321 简单dfs
- Android Studio常见错误
- centos配置amp环境
- CentOS安装rar、unrar解压缩软件的方法
- Swift 教學:如何使用iOS Charts API 製作漂亮的圖表
- linux下定时删除指定目录下指定时间前的文件
- 侧滑控件DrawerLayout浅析
- 使用Notepad++进行php开发所必需的插件
- 转盘抽奖(SurfaceView)