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

更多相关文章

  1. android 多项对话框
  2. android 隐藏ListView滚动条
  3. Android(安卓)通过继承TextView类自定义字体默认颜色
  4. Android(安卓)ListView(Selector 背景图片 全选 Checkbox等按钮)
  5. Android控件之ImageView,Button, ImageButton
  6. Android6.0 MTK 需求文档(五)
  7. Android开发小技巧1
  8. 14 Android(安卓)android 按钮效果的两种实现方法
  9. android 五种布局模式

随机推荐

  1. android中下载文件到sdcard和进度条小结
  2. Android中的测试小demo
  3. 介绍几本初学Android资料和教材——选对
  4. android中下载文件到sdcard和进度条小结
  5. android之PhoneGap入门
  6. Android(安卓)4.0 Launcher2源码分析——
  7. android初学者的探索之路(Android音乐播放
  8. Android(安卓)体系结构
  9. unity调用MMBilling_2.4.2 Android(安卓)
  10. Android使用Application总结