【发布时间】:2017-05-22 06:37:36
【问题描述】:
我正在使用Fresco 图像加载器库,我想在Fresco's 圆角边框上添加自定义image 图标。我用谷歌搜索找到这样的功能,但没有得到任何合适的解决方案。请帮助我,这怎么可能。我附上了screenshot,我需要根据我的要求提供这样的功能。
【问题讨论】:
-
在Relative layout里面添加Icon和Image就可以达到你的要求了
我正在使用Fresco 图像加载器库,我想在Fresco's 圆角边框上添加自定义image 图标。我用谷歌搜索找到这样的功能,但没有得到任何合适的解决方案。请帮助我,这怎么可能。我附上了screenshot,我需要根据我的要求提供这样的功能。
【问题讨论】:
Fresco 支持叠加,因此只需使用您的图标将叠加层添加到 drawee 层次结构中。
http://frescolib.org/docs/drawee-branches.html#Overlays
例如,在 XML 中你可以这样做:
<com.facebook.drawee.view.SimpleDraweeView
xmlns:fresco="http://schemas.android.com/apk/res-auto"
android:id="@+id/my_image_view"
android:layout_width="40dp"
android:layout_height="40dp"
fresco:overlayImage="@drawable/your_overlay"
/>
您必须相应地定位叠加图像,例如使用<bitmap android:gravity="bottom|right" />、ninepatch 或自定义可绘制对象。另见https://developer.android.com/guide/topics/resources/drawable-resource.html 和How to get gravity 'bottom' working on a drawable in xml
【讨论】: