如何使ImageView从Activity转换为Fragment?

时间:2016-03-27 08:25:11

标签: android android-fragments

我使用ScrollView显示10个最新图像。点击特定元素后,我想用ViewPager开始新的活动,其中包含10个最新图像的所有细节,并且应该在小图像和大图像之间进行转换。但它只显示ViewPager中邻居元素的退出转换。你能帮帮我吗?

代码:

//shared element has transitionName in XML
//this is how i start activity of ViewPager
ActivityOptions transitionActivityOptions = ActivityOptions.makeSceneTransitionAnimation(MainActivity.this, v, trans.getName());
startActivity(i, transitionActivityOptions.toBundle());

//setup ViewPager in started Activity
ViewPager myViewPager = (ViewPager) findViewById(R.id.postsViewPager);
PostViewPager avp = new PostViewPager(getSupportFragmentManager(), postEntities);
myViewPager.setAdapter(avp);

//every Fragment in ViewPager has set up transitionName programatically in onCreateView
final ImageView iv = (ImageView) v.findViewById(R.id.imageView14);
iv.setTransitionName("changing"

0 个答案:

没有答案