【问题标题】:How to add custom Icon on fresco's rounded border in android如何在android中壁画的圆角边框上添加自定义图标
【发布时间】:2017-05-22 06:37:36
【问题描述】:

我正在使用Fresco 图像加载器库,我想在Fresco's 圆角边框上添加自定义image 图标。我用谷歌搜索找到这样的功能,但没有得到任何合适的解决方案。请帮助我,这怎么可能。我附上了screenshot,我需要根据我的要求提供这样的功能。

【问题讨论】:

  • 在Relative layout里面添加Icon和Image就可以达到你的要求了

标签: android fresco


【解决方案1】:

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"
  />

您必须相应地定位叠加图像,例如使用&lt;bitmap android:gravity="bottom|right" /&gt;、ninepatch 或自定义可绘制对象。另见https://developer.android.com/guide/topics/resources/drawable-resource.htmlHow to get gravity 'bottom' working on a drawable in xml

【讨论】:

  • 非常感谢您的回答,但能否请您提供示例代码以获取此类功能。
猜你喜欢
  • 1970-01-01
  • 2012-06-16
  • 2019-10-31
  • 2022-10-16
  • 1970-01-01
  • 2019-04-02
  • 2016-10-13
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多