我一直在尝试使用 android 转换框架,但遇到了一些问题。我有一个从屏幕中心移动到左上角的 ImageView。一切正常,但是一旦新场景进入,从服务器加载的图像就会从图像视图中消失。我明白,正是这种转变的观点,内容丢失了。但是我该如何处理这个问题。代码如下: -
<!-scene1.xml-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:id="@+id/container"
android:layout_height="match_parent">
<ImageView
android:layout_width="150dp"
android:layout_height="215dp"
android:layout_centerInParent="true"
android:id="@+id/theimage"
/>
</RelativeLayout>
<!--scene2.xml-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:id="@+id/container"
android:layout_height="match_parent">
<ImageView
android:layout_width="150dp"
android:layout_height="215dp"
android:layout_alignParentTop="true"
android:id="@+id/theimage"
/>
</RelativeLayout>
<!--theFragment-->
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View theViewGroup=inflater.inflate(R.layout.scene1, container, false);
//both scene1 and scene 2 contain an imageview
//the imageview of scene1 is populated by an image downloaded by picasso
RelativeLayout thecont= (RelativeLayout) movieDetailView.findViewById(R.id.moviedesccontainer);
mScene=Scene.getSceneForLayout(thecont,R.layout.scene2,getActivity());
someButton.onClickListener(new OnClickListener(){
public void onClick(){
//when scene2 comes is the imageview has moved to the desired place but there is no image in there.How do we get the image which we downloaded earlier
TransitionManager.go(mScene);
};
});
return movieDetailView;
}