So I am trying to use ActivityOptionsCompat here
ActivityOptionsCompat options =
ActivityOptionsCompat.makeSceneTransitionAnimation(NoticeViewer.class,
v, // The view which starts the transition
transitionName // The transitionName of the view we’re transitioning to
);
The first argument is supposed to be an Activity object, which I'm trying to supply through the relevant class file, but I get the following type conversion error -
Error:(194, 54) error: no suitable method found for makeSceneTransitionAnimation(Class<NoticeViewer>,View,String)
method ActivityOptionsCompat.makeSceneTransitionAnimation(Activity,View,String) is not applicable
(actual argument Class<NoticeViewer> cannot be converted to Activity by method invocation conversion)
method ActivityOptionsCompat.makeSceneTransitionAnimation(Activity,Pair<View,String>...) is not applicable
(actual argument Class<NoticeViewer> cannot be converted to Activity by method invocation conversion)
I'm missing something really simple, but what is it?
使用NoticeViewer.this
代替NoticeViewer.class
将当前的活动上下文作为第一个参数传递:
ActivityOptionsCompat.makeSceneTransitionAnimation(NoticeBoard.this,...)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.