3

我有兩個活動,其中第一個活動包含在第一個活動中添加的片段中的回收視圖,第二個活動包含摺疊工具欄佈局中的工具欄,我創建了共享元素轉換在這兩個活動之間,當用戶點擊任何一個包含我想用作第二個活動的工具欄圖像的共享元素的圖像的回收視圖項目時,我已經設置了這樣的轉換。使用共享元素的背景故障

第一個活動

ChangeBounds changebound=new ChangeBounds(); 
changebound.setDuration(500); 
getWindow().setSharedElementExitTransition(changebound); 

次活動

ChangeBounds changebound=new ChangeBounds(); 
changebound.setDuration(500); 
getWindow().setSharedElementEnterTransition(changebound); 

我凝視次活動從第一個活動的回收站視圖onItemClick這樣

Pair<View, String> imagePair=Pair.create(itemView.findViewById(R.id.imgChannelImage), activity.getResources().getString(R.string.channel_name)); 
    Bundle mBundle = new Bundle(); 
    mBundle.putInt("Position", getLayoutPosition()); 
    mBundle.putString("ChannelName", "One Direction " +getLayoutPosition()); 
    Intent i = new Intent(activity, ProChannelPageActivity.class); 
    i.putExtras(mBundle); 
    ActivityOptionsCompat options = ActivityOptionsCompat. 
          makeSceneTransitionAnimation(context,imagePair); 
    activity.startActivity(i, options.toBundle()); 

我能夠在這兩者之間共享元素轉換。但問題是出現背景故障,即我們能夠在圖像視圖從一個活動移動到另一個活動時看到少數分數的第一個活動背景。

+0

您是否爲第一個活動xml文件設置了任何背景? – Piyush

+0

nope ..我還沒有 –

+0

也請添加它的外觀看起來如何? – Piyush

回答

-1

我可以理解你的問題。 基本上發生的事情是,你只分享你提到的2個意見。但是頂部的狀態欄,底部的導航欄(或者其他人,在你的情況下)不會被共享。所以這似乎是一個眨眼。

你可以看到這篇文章,看看它是否有幫助。

https://stackoverflow.com/a/26748694/2346980