当`RecyclerView项单击启动详细活动时,我有一个共享元素转换,但项目点击的涟漪效果永远不可见
使用共享元素转换启动活动
Intent intent = IntentUtils.createDetailsIntent(InspectionListFragment.this.getContext(),record);
Bundle options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),view,getString(R.string.transition_element)).toBundle();
getActivity().startActivity(intent,options);
我注意到了这条日志消息
D/OpenGLRenderer: endAllStagingAnimators on 0x95e86600 (RippleDrawable) with handle 0xaa6c2760
如果我删除了转换,则纹波有效(我没有看到此消息).
延迟活动开始使用Handler
如果我使用带有postDelayed的Handler来启动Activity,则结果是混合的.我看到了波纹,但过渡并不顺利:
handler.postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = IntentUtils.createDetailsIntent(InspectionListFragment.this.getContext(),record);
Bundle options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(),getString(R.string.transition_element)).toBundle();
getActivity().startActivity(intent,options);
}
},200);
使用ListView
请注意,使用具有相同项目布局和makeSceneTransitionAnimation的ListView可以正常工作.不幸的是,这不合适.
项目布局
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"