Android 3D翻转实现

一、引入依赖

复制代码
allprojects {
  repositories {
    jcenter()
    maven { url "https://jitpack.io" }
  }
}

dependencies {
	  implementation("com.github.githubwing:ThreeDLayout:1.0.0")
	}

二、xml使用

复制代码
<?xml version="1.0" encoding="utf-8"?>
    <com.wingsofts.threedlayout.ThreeDLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/td_layout"
        android:background="@drawable/bg_trans_radius"
        android:layout_width="@dimen/dp_200"
        android:layout_height="@dimen/dp_200"
        >
    <ImageView
        android:id="@+id/modelPic"
        android:layout_width="@dimen/dp_200"
        android:layout_height="@dimen/dp_200"
        android:src="@drawable/location"
        android:layout_centerInParent="true"
        />
    </com.wingsofts.threedlayout.ThreeDLayout>

三、在RecyclerView中使用

可以实现指定位置item翻转

复制代码
        binding.chooseModel.setOnClickListener {
            val viewHolder = binding.rvContent.findViewHolderForAdapterPosition(choosePosition)
            if (viewHolder?.itemView != null) {
                val tdLayout: ThreeDLayout = viewHolder.itemView.findViewById(R.id.td_layout)
                tdLayout.startHorizontalAnimate()
                Thread {
                    try {
                        Thread.sleep(2500)
                    } catch (e: InterruptedException) {
                        e.printStackTrace()
                    }
                    runOnUiThread {
                        tdLayout.stopAnimate()
                        showToasts("翻转结束")
                    }
                }.start()
            }
        }
相关推荐
恋猫de小郭5 分钟前
Flutter 状态管理基准测评,一个很有趣的观点
android·前端·flutter
可乐鸡翅yeah_7 分钟前
App WebView 加载 M3U8 流媒体踩坑,安卓 iOS 混合开发播放异常定位
android·ios·harmonyos·m3u8·m3u8在线播放
木卫四科技32 分钟前
从函数劫持到智能体控制平面:Hook 如何从 Linux-Android 演化到 Agent Runtime
android·linux·人工智能·安全
菠萝加点糖34 分钟前
Android applicationIdSuffix 详解
android·gitee·kotlin
AIGC小尼1 小时前
穿山甲 + 腾讯短剧短视频聚合广告平台|Android+SpringBoot+Vue+Docker 完整部署指南
android·vue.js·spring boot·聚合广告·广告平台·穿山甲广告·腾讯广告
JMchen1233 小时前
【Android 性能优化实战 60 讲】06 GPU 呈现模式与卡顿视觉验证:拆解柱状图分层,秒辨渲染慢与等待慢
android·性能优化·实战·源码分析·渲染优化·gpu呈现模式·卡顿优化
91刘仁德10 小时前
MYSQL 事务原理及使用
android·mysql·adb
一笑的小酒馆12 小时前
AndroidKMP之瀑布流实现
android
RainyJiang12 小时前
AI时代下,Android的边界正在消失
android·openai·ai编程
Android-Flutter13 小时前
android 内存抖动详解
android