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)}

运行效果

Android VR效果GoogleVR_第1张图片

源代码在此 Github

更多相关文章

  1. Android 异步任务加载图片代码
  2. Android textView点击滚动(跑马灯)效果
  3. android TextView的跑马灯效果的实现
  4. android 开发上传图片遇到返回 FileNotFoundException
  5. Android ListView(Selector 背景图片 全选 Checkbox等按钮)
  6. android 动画之水波纹效果ripple
  7. Android中的Picasso实现圆角图片
  8. Android(Java):Android ListView checkbox 全选效果
  9. Android 设置图片的四个角 为圆角

随机推荐

  1. android 仿微信5版本实现滑动导航条
  2. Android监听屏幕屏幕锁屏与解锁
  3. View的XML 属性大全(官方文档)
  4. Android(安卓)Studio出现Failed to open
  5. Android重写SimpleCursorAdapter例子
  6. 提升基于英特尔® 架构的 Android* 模拟
  7. android组件
  8. android 播放Raw文件夹下的音乐文件
  9. android中Notification的使用
  10. Android(安卓)屏幕截图 代码