TextView,Button 等设置 setCompoundDrawables 无效
来源:互联网 发布:源码搭建网站 编辑:程序博客网 时间:2024/05/01 17:34
在实现设置TextView 上方显示图片的时候遇到 不显示的 现象。代码如下
mainTv.setCompoundDrawables(null, getResources().getDrawable(R.mipmap.home_press), null, null);
API 解释
Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text. Use null if you do not want a Drawable there. The Drawables must already have had setBounds(Rect) called.
即对 Drawable 进行宽高设置即可
Drawable dra = getResources().getDrawable(R.mipmap.home_press); dra.setBounds(0, 0, dra.getMinimumWidth(), dra.getMinimumHeight()); mainTv.setCompoundDrawables(null, dra, null, null);
0 0
- TextView,Button 等设置 setCompoundDrawables 无效
- TextView,Button 等设置 setCompoundDrawables 无效
- 关于 TextView.setCompoundDrawables() 无效
- TextView设置setCompoundDrawables或setCompoundDrawablesWithIntrinsicBounds区别
- TextView setCompoundDrawables()
- android给Button或TextView等设置字体
- android使用java代码设置textview、button等内容颜色
- TextView 设置background(backgroundResource)后padding等属性无效
- TextView设置selector无效
- TextView——setCompoundDrawables
- textView-setCompoundDrawables方法解析
- TextView setCompoundDrawables不显示
- Android setCompoundDrawables无效
- textView设置onclick:xxx无效
- Android TextView设置Drawable无效
- TextView 背景设置无效解决
- TextView行距等设置
- android Button,textView 等控件设置控件内嵌周围图片使用方法
- 润乾报表reportconfig中配置数据库直连
- 教你怎么快速设置FL Studio中的通道乐器
- 尾递归
- zookeep
- 关于Error:(1, 0) Unsupported major.minor version 52.0的问题
- TextView,Button 等设置 setCompoundDrawables 无效
- 七牛海量数据处理平台自研容器调度框架实践
- java异常
- How to Configure Your Terminal Environment: Cygwin/X
- 团队管理
- UE4 TextRenderComponent 换行
- 互联网风控模型需要多大数据?
- ImageLoader使用详解
- android N编译