我正在做一个没有声音也没有过渡到其他图像的 VR 旅游景点。我的一位朋友告诉我,如果每次他想查看其他图像时都需要将手机移至 VR BOX 以再次查看,并且他添加了声音以使其逼真,那么这不是用户友好的。
帮助我了解如何在 com.google.vr.sdk.widgets.pano 中添加音频和过渡我不知道如何制作这个。
分段
public class TW1 extends Fragment {
private VrPanoramaView panoWidgetView;
private ImageLoaderTask backgroundImageLoaderTask;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.activity_tw1, container,false);
panoWidgetView = (VrPanoramaView) v.findViewById(R.id.pano_view);
return v;
}
@Override
public void onPause() {
panoWidgetView.pauseRendering();
super.onPause();
}
@Override
public void onResume() {
panoWidgetView.resumeRendering();
super.onResume();
}
@Override
public void onDestroy() {
panoWidgetView.shutdown();
super.onDestroy();
}
private synchronized void loadPanoImage() {
ImageLoaderTask task = backgroundImageLoaderTask;
if (task != null && !task.isCancelled()) {
task.cancel(true);
}
VrPanoramaView.Options viewOptions = new VrPanoramaView.Options();
viewOptions.inputType = VrPanoramaView.Options.TYPE_STEREO_OVER_UNDER;
String panoImageName = "tw1.jpg";
task = new ImageLoaderTask(panoWidgetView, viewOptions, panoImageName);
task.execute(getActivity().getAssets());
backgroundImageLoaderTask = task;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
loadPanoImage();
}
}
xml 文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:background="#ffffff">
<TextView
android:id="@+id/welcome_title"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_weight=".2"
android:text="@string/chocolate_hills"
android:textAlignment="center"
android:textStyle="bold"
android:textAllCaps="true"
android:textAppearance="?android:attr/textAppearanceLarge" />
<com.google.vr.sdk.widgets.pano.VrPanoramaView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:id="@+id/pano_view"
android:layout_margin="5dip"
android:scrollbars="none"
android:contentDescription="@string/codelab_img_description" />
<TextView
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_weight=".2"
android:text="@string/chocolate_hills_location"
android:textStyle="bold"
android:textSize="12sp"
android:textColor="#000000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_weight="1"
android:text="@string/chocolate_hills_desc"
android:textColor="#000000"/>
</LinearLayout>