请告诉我为什么会这样?我做错什么了?屏幕视频
听众
public interface NoteListener {
void onNoteClicked(Note note, int position, RelativeLayout noteLayout);
}
适配器
NoteViewHolder(@NonNull View itemView) {
...
relativeLayoutNote = itemView.findViewById(R.id.rl_note);
itemView.setOnClickListener(v -> noteListener.onNoteClicked(sortedList.get(getAdapterPosition()),
getAdapterPosition(), relativeLayoutNote));
}
主要活动
@Override
public void onNoteClicked(Note note, int position, RelativeLayout noteLayout) {
if (!isClick) {
DetailNoteActivity.start(this, note, findViewById(R.id.rl_note));
isClick = true;
}
}
细节活动
public static void start(Activity caller, Note note, RelativeLayout noteLayout) {
Intent intent = new Intent(caller, DetailNoteActivity.class);
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(
caller, noteLayout, "note");
if (note != null) {
intent.putExtra(NOTE, note);
}
caller.startActivity(intent, options.toBundle());
}
项目注解
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
...
android:background="@drawable/background_note"
android:transitionName="note">...
活动详细信息
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:transitionName="note"
android:animateLayoutChanges="true">...
1条答案
按热度按时间pnwntuvh1#
我决定用下面的方法,可能很笨拙,如果有别的方法请写。在mainactivity中添加了以下内容: