Android VR效果GoogleVR
16lz
2021-01-23
Android 原生VR效果
需要引用官方依赖
implementation 'com.google.vr:sdk-panowidget:1.80.0'
布局中引用
<com.google.vr.sdk.widgets.pano.VrPanoramaView android:id="@+id/mVrPanoramaView" android:layout_width="0dp" android:layout_height="0dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" />
MainActivity中核心代码
mOption = VrPanoramaView.Options()mBitmap = BitmapFactory.decodeResource(resources, R.drawable.icon_001)mVrView = findViewById<VrPanoramaView>(R.id.mVrPanoramaView).apply { // 不隐藏全屏模式按钮[默认也是不] setFullscreenButtonEnabled(true) // 设置不隐藏最左边信息的按钮[默认也是不] setInfoButtonEnabled(true) // 设置不隐藏立体模型的按钮[默认也是不] setStereoModeButtonEnabled(true) // 设置监听 setEventListener(ActivityEventListener()) // 加载图片 loadImageFromBitmap(mBitmap, mOption)}
运行效果
源代码在此 Github
更多相关文章
- Android 异步任务加载图片代码
- Android textView点击滚动(跑马灯)效果
- android TextView的跑马灯效果的实现
- android 开发上传图片遇到返回 FileNotFoundException
- Android ListView(Selector 背景图片 全选 Checkbox等按钮)
- android 动画之水波纹效果ripple
- Android中的Picasso实现圆角图片
- Android(Java):Android ListView checkbox 全选效果
- Android 设置图片的四个角 为圆角