自定义控件开源库

Android-推荐一个自定义ImageView开源库(andr

2022-07-30  本文已影响0人  阿博聊编程
图片来源网络,入侵必删

你有没有遇到自定义形状图片的需求呢?我发现一个了关于自定义图片形状的开源库。这篇博客来分享它,希望对你有所帮助。

android-shape-imageview

这个库主要提供自定义形状的Imageview,以及更多自定义框架。

引入项目

implementation 'com.github.siyamed:android-shape-imageview:0.9.+@aar'

截止我写博客的最新版本是0.9最近的版本请查看开源库文档

需要注意的事情是,因为比较老的开源库,我们可以看代码学习。这个库并不适配AndroidX,导入最新的项目中可能会出现报错。

效果图

来自开源库的效果图

使用示例

BubbleImageView
<com.github.siyamed.shapeimageview.BubbleImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/neo"
    app:siArrowPosition="right"
    app:siSquare="true"/>

属性说明:

RoundedImageView
<com.github.siyamed.shapeimageview.RoundedImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/neo"
    app:siRadius="6dp"
    app:siBorderWidth="6dp"
    app:siBorderColor="@color/darkgray"
    app:siSquare="true"/>

属性说明:

CircularImageView
<com.github.siyamed.shapeimageview.CircularImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/neo"
    app:siBorderWidth="6dp"
    app:siBorderColor="@color/darkgray"/>

属性说明:

上面我为大家列举项目开发中比较常见到的需求实现,想要了解更多的效果的话,需要具体去看看开源库源码,可以尝试自己定制一下。

上一篇 下一篇

猜你喜欢

热点阅读