Android(安卓)VR效果GoogleVR
16lz
2021-12-04
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 隐藏ListView滚动条
- Android(安卓)通过继承TextView类自定义字体默认颜色
- Android(安卓)ListView(Selector 背景图片 全选 Checkbox等按钮)
- Android控件之ImageView,Button, ImageButton
- Android6.0 MTK 需求文档(五)
- Android开发小技巧1
- 14 Android(安卓)android 按钮效果的两种实现方法
- android 五种布局模式