https://blog.csdn.net/fukaimei/article/details/107938681
前 言
前段时间看到Soul社交应用首页的3D星球视图旋转样式(如下图),所以就想自己能不能实现一个类似的功能。本着不要重复造轮子的原则,所以在网上找有没有开源的轮子,果然真找到有大神开源的依赖库,大神开源的依赖库如下:https://github.com/misakuo/3dTagCloudAndroid,那么下面看看如何实现仿Soul社交应用首页3D星球视图旋转样式的功能。
编码实现
首先在AS的内层build.gradle里添加3d星球视图旋转样式的依赖
dependencies {
........
// 3d星球视图旋转样式
implementation 'com.moxun:tagcloudlib:1.2.0'
}
添加 Layout 布局
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#12121F"
tools:context=".MainActivity">
<com.moxun.tagcloudlib.view.TagCloudView
android:id="@+id/mTagCloudView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:autoScrollMode="uniform"
app:radiusPercent="0.8"
app:scrollSpeed="1" />
</androidx.constraintlayou