google vr sdk(全景图的播放)

全景图布局:

xml version="1.0" encoding="utf-8"?>
xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
            android:id="@+id/vr_panorama"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
纯代码:

/**
 * Created by Administrator on 2016/8/8.
 */
public class PicActivity extends Activity {
    @InjectView(R.id.vr_panorama)
    VrPanoramaView vrPanorama;
    private VrPanoramaView.Options options;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.pic_activity);
        ButterKnife.inject(this);
        initData();
    }
    void initData(){
        options = new VrPanoramaView.Options();
        //本机
        try {
            Intent intent=getIntent();
            String uri=intent.getStringExtra("uri");
            Bitmap bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), Uri.parse(uri));
            vrPanorama.loadImageFromBitmap(bitmap,options);
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

}
这只是些简单实用,更高级的东西还请各位指教了

你可能感兴趣的:(移动开发002)