setCompoundDrawables不显示图片
2017-08-03 20:26
543 查看
BUG #28475
海外版登陆界面缺少Hi图标中代码不起作用的问题
dynamicAddView会调用BaseActivity的dynamicAddSkinEnableView,
然后调用AttrFactory.get,通过if else判断
mSkinAttr = new DrawableLeftAttr();
看代码知道最终调用setCompoundDrawables。通过debug发现已进入equas方法,
但最终并未成功加载图片到textView的左侧。
然后去看setCompoundDrawables源码,发现有这么一句注释。
Sets the Drawables (if any) to appear to the left of, above, to the
* right of, and below the text. Use {@code
null} if you do not want a
* Drawable there. The Drawables must already have had
* {@link
Drawable#setBounds} called.
skin.lib不能修改源码,只能写demo来验证是不是这个原因造成的。
布局这样子,能正常显示,运行起来也没有问题。
然后代码里修改,通过setCompoundDrawables在Textview左侧加图片,运行发现不能正常显示。
调用drawable.setBounds
后能够正常显示。
2、直接调用setCompoundDrawablesWithIntrinsicBounds方法,不用setBounds也能正常显示。
海外版登陆界面缺少Hi图标中代码不起作用的问题
dynamicAddView会调用BaseActivity的dynamicAddSkinEnableView,
然后调用AttrFactory.get,通过if else判断
mSkinAttr = new DrawableLeftAttr();
看代码知道最终调用setCompoundDrawables。通过debug发现已进入equas方法,
但最终并未成功加载图片到textView的左侧。
然后去看setCompoundDrawables源码,发现有这么一句注释。
Sets the Drawables (if any) to appear to the left of, above, to the
* right of, and below the text. Use {@code
null} if you do not want a
* Drawable there. The Drawables must already have had
* {@link
Drawable#setBounds} called.
skin.lib不能修改源码,只能写demo来验证是不是这个原因造成的。
布局这样子,能正常显示,运行起来也没有问题。
然后代码里修改,通过setCompoundDrawables在Textview左侧加图片,运行发现不能正常显示。
调用drawable.setBounds
后能够正常显示。
2、直接调用setCompoundDrawablesWithIntrinsicBounds方法,不用setBounds也能正常显示。
相关文章推荐
- Android TextView setcompounddrawables 图片不显示的问题
- Android setcompounddrawables 无效,图片不显示
- setCompoundDrawables不显示图片
- textview.setCompoundDrawables不显示图片
- android TextView如何通过setCompoundDrawables调整文字和图片的位置(文字显示在图片内)?
- TextView的setCompoundDrawables不显示问题解决
- TextView setCompoundDrawables不显示
- TextView的setCompoundDrawables不显示问题解决
- 切换同一个位置上的图片setCompoundDrawables
- android 设置图片小妙招 setCompoundDrawables与setCompoundDrawablesWithIntrinsicBounds
- android setCompoundDrawables 不显示问题
- setCompoundDrawables 不能显示Drawable出来的问题。
- android 设置图片小妙招 setCompoundDrawables与setCompoundDrawablesWithIntrinsicBounds
- android setCompoundDrawables 不显示问题
- Android中的Button可同时设置图片跟文字(setCompoundDrawablesWithIntrinsicBounds)
- 图片不能显示: [cell.imageView setImageWithURL:imageUrl placeholderImage:nil options:SDWebImageLowPriority
- 安装Maven,运行mvn -v后出现 Error: JAVA_HOME is set to an invalid directory.(图片可能太大,无法显示,有时间再上传)
- setCompoundDrawables与setCompoundDrawablesWithIntrinsicBounds的区别
- 关于真机测试的android选择图片在ImageView上显示,调用setImageBitmap无法显示和闪退、控件消失
- TabSpec.setIndicator图片标题只能显示一个的解决办法