放大并缩小android

时间:2018-04-17 07:49:41

标签: java android android-fragments android-animation

我想平滑地将片段放大到全屏,并且在退出时平滑缩小并适合其实际位置我该怎么做

谢谢!

用于平滑放大,当替换片段时:

 ViewCompat.setTransitionName(imageView, 0 + "_image");

    viewPagerFragment.setSharedElementEnterTransition(new DetailsTransition());
                viewPagerFragment.setEnterTransition(new DetailsTransition());
                viewPagerFragment.setReturnTransition(new DetailsTransition());
                viewPagerFragment.setAllowReturnTransitionOverlap(false);
                viewPagerFragment.setAllowEnterTransitionOverlap(false);
                //listener.subCategoryItemClick(new ProductDetailFragment());
                postponeEnterTransition();


   getParentFragment().getFragmentManager()
                        .beginTransaction()
                        .replace(R.id.fragment, viewPagerFragment)
                       // .setCustomAnimations(R.anim.zoom_in, R.anim.zoom_out)
                        .addSharedElement(imageView, "productImage")
                        .addToBackStack(null)
                        .commit();

但片段以毛刺来临和离开

0 个答案:

没有答案