您的位置:首页 > 移动开发 > Android开发

360度全景展示

2017-09-07 10:37 239 查看
1.在build.gradle文件中添加依赖

allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}

2.在build.gradle文件添加库依赖

compile 'com.github.CN-ZPH:weibo360panorama:v1.0.1'

此时,你的build.gradle:

apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.administrator.firstdemo1"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
allprojects { repositories { maven { url 'https://jitpack.io' } } }
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.github.CN-ZPH:weibo360panorama:v1.0.1' compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}

3.添加布局文件

<com.zph.glpanorama.GLPanorama
android:id="@+id/mGLPanorama"
android:layout_width="match_parent"
android:layout_height="match_parent">
</com.zph.glpanorama.GLPanorama>

4.传入你的全景图

public class Main2Activity extends AppCompatActivity {
private GLPanorama mGLPanorama;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
//初始化全景控件
mGLPanorama= (GLPanorama) findViewById(R.id.mGLPanorama);
mGLPanorama.setGLPanorama(R.drawable.bbb);
}
}

运行即合理
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  360全景 android 360