代码设置TextView的drawableLeft
2016-03-03 00:00
274 查看
摘要: 代码设置TextView的drawableLeft
Drawable drawable = ContextCompat.getDrawable(mContext, R.drawable.publish_dynamic_entry);
int size = (int) SizeUtils.dp2Px(getResources(), 24.0f);
// 这一步必须要做,否则不会显示.
drawable.setBounds(0, 0, size, size);
mPublishTv.setCompoundDrawables(drawable, null, null, null);
Drawable drawable = ContextCompat.getDrawable(mContext, R.drawable.publish_dynamic_entry);
int size = (int) SizeUtils.dp2Px(getResources(), 24.0f);
// 这一步必须要做,否则不会显示.
drawable.setBounds(0, 0, size, size);
mPublishTv.setCompoundDrawables(drawable, null, null, null);
相关文章推荐
- VIEWGOOD(远古)教育资源管理发布平台建设方案
- PHP-FPM的理解
- 某个sb使用Qt图形库时 用了很多的QTimer导致的问题
- 设计模式--单例模式
- Struts2 中测试 action
- java反射详解
- java类的生命周期
- Java反射 getFields()和getDeclaredFields()的区别
- yii中select字段时用别名的设置方法
- 编写GO的WEB开发框架(二): 我期望怎么用框架来开发我的应用?
- javac -g 参数
- php缓存技术总结
- java io
- java 静态代码块 构造器 (一)
- PHP 7.0.4 Windows升级
- python面向对象编程初学整理
- Java+Poi 读取Excel做数据导入时获取cell值的方法
- php建立多级目录
- spring依赖注入基础
- Java 泛型中? super T和? extends T的区别