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());
我能夠在這兩者之間共享元素轉換。但問題是出現背景故障,即我們能夠在圖像視圖從一個活動移動到另一個活動時看到少數分數的第一個活動背景。
您是否爲第一個活動xml文件設置了任何背景? – Piyush
nope ..我還沒有 –
也請添加它的外觀看起來如何? – Piyush