堆叠头像,仿写直播间顶部头像折叠

感兴趣的可以下载源码研究:https://github.com/wangqiux/AvatarView

效果展示

第一步 在project build文件中添加

        allprojects {

          repositories {

                maven { url 'https://jitpack.io' }

                }

        }

第二步 添加依赖库


    api 'com.github.wangqiux:AvatarView:v1.0.5'


第三步 xml添加布局


    <com.wqx.avatar.AvatarView

        android:id="@+id/avatar"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_gravity="center"

        app:marginWidth="1"

        app:isLastComplete="false"

        app:isShowAnimation="false"

        app:isShowFrame="true"

        app:maxCount="6"

        app:radius="20"

        app:space="0.7"/>

第四步  初始化头像

      mAvatarView.initAvatars(mAvatarList);


或单独添加头像

      mAvatarView.addAvatar(mAvatarList.get(index), mAvatarView.getmAvatarCount());  //添加的链接,添加的位置  没有特殊要求位置  可不填写位置


移除头像

      mAvatarView.deleteAvatar(mAvatarView.getmAvatarCount()-1);

最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容