Android 如何使用SceneTransitionAnimation在两个具有不同速率的imageview之间进行转换
我有两个不同大小的imageView等待过渡。但由于大小不同,置换过程在最后受到了冲击 ImageView1的尺寸为340*340,ScaleType为中间裁剪 ImageView2全屏显示,刻度类型为fitXY 这是我的密码 启动活动1Android 如何使用SceneTransitionAnimation在两个具有不同速率的imageview之间进行转换,android,shared-element-transition,Android,Shared Element Transition,我有两个不同大小的imageView等待过渡。但由于大小不同,置换过程在最后受到了冲击 ImageView1的尺寸为340*340,ScaleType为中间裁剪 ImageView2全屏显示,刻度类型为fitXY 这是我的密码 启动活动1 Intent intent=new Intent(getActivity(),Show_Picture.class); intent.putExtra("hinhanh",caculator(position)); if (Build.VERSION.SDK_
Intent intent=new Intent(getActivity(),Show_Picture.class);
intent.putExtra("hinhanh",caculator(position));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ActivityOptionsCompat optionsCompat=ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),view,"myimage");
startActivity(intent,optionsCompat.toBundle());
}
回到活动2
public void onBackPressed() {
super.onBackPressed();
/*finish();
overridePendingTransition(0,R.anim.show_picture_out);*/
ConstraintLayout.LayoutParams layoutParams= (ConstraintLayout.LayoutParams) imageView.getLayoutParams();
layoutParams.height=layoutParams.width;
imageView.setLayoutParams(layoutParams);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
}
任何帮助都将不胜感激^^请确保
视图
确实是您的图像视图
,并确保第二个活动中的图像视图
具有xml标记
android:transitionName="myimage"
是的,但它总是有一个小幻灯片你说的小幻灯片是什么意思?每个幻灯片都有两个不同的中心裁剪,