I am trying to make an Android Shared Transtion between TextView and EditText´ but when showing the resulting Activity the text in the EditView have been shifted up. See attached pictures. Also, clicking on the have been shifted up. See attached pictures. Also, clicking on the have been shifted up. See attached pictures. Also, clicking on the EditView` after the transition returns the text to the correct position.
First, click any line in the RecylcerView:

The cell view, TextEdit date, and TextEdit name are divided into the following activity. The background of the cell is transferred to the toolbar.

Set activity cell:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/adapter_actionlist" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:clickable="true" android:focusable="true" android:background="?android:attr/selectableItemBackground" android:transitionName="@string/transition_key_action" > <RelativeLayout android:layout_width="match_parent" android:layout_height="72dp" > <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/adapter_actionList_checkBox" android:layout_alignParentStart="true" android:layout_centerVertical="true" android:layout_marginLeft="12dp"/> <LinearLayout android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:layout_alignParentStart="true" android:layout_marginLeft="72dp" android:layout_marginRight="16dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:maxLines="2" android:ellipsize="end" android:textAppearance="?android:attr/textAppearanceMedium" android:text="Large Text" android:id="@+id/adapter_actionlist_toplabel" android:paddingTop="0dp" android:paddingBottom="0dp" android:textSize="14sp" android:transitionName="@string/transition_key_action_name" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Medium Text" android:id="@+id/adapter_actionlist_bottomlabel" android:paddingTop="0dp" android:paddingBottom="0dp" android:autoText="false" android:textSize="14sp" android:transitionName="@string/transition_key_action_date" /> </LinearLayout> </RelativeLayout> </LinearLayout>
End of layout for activity:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v7.widget.Toolbar android:id="@+id/activity_action_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/primary_color" app:contentInsetEnd="0dp" app:contentInsetStart="0dp" android:elevation="4dp" android:fitsSystemWindows="true" app:navigationIcon="@drawable/abc_ic_ab_back_mtrl_am_alpha" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" android:transitionName="@string/transition_key_action"> <LinearLayout android:id="@+id/actvity_action_focus_placeholder" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_marginTop="56dp" android:layout_marginLeft="16dp" android:descendantFocusability="beforeDescendants" android:focusableInTouchMode="true" android:paddingBottom="6dp"> <EditText android:id="@+id/activity_action_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Title" android:layout_marginRight="16dp" android:imeOptions="actionDone" android:singleLine="true" android:ellipsize="none" android:inputType="text" android:textSize="22sp" android:textColor="#fff" android:focusable="true" android:background="@android:color/transparent" android:transitionName="@string/transition_key_action_name"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:text="Från: [Möte] (Datum)" android:id="@+id/activity_action_meetingdate" android:textColor="#fff" android:layout_marginBottom="6dp" android:layout_marginRight="16dp" android:transitionName="@string/transition_key_action_date"/> </LinearLayout> </android.support.v7.widget.Toolbar> <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/activity_action_swipe_refresh_layout" android:layout_width="match_parent" android:layout_height="wrap_content" tools:context=".Activities.ActionActivity"> <android.support.v7.widget.RecyclerView android:id="@+id/activity_action_recyclerview" android:scrollbars="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:descendantFocusability="beforeDescendants"/> </android.support.v4.widget.SwipeRefreshLayout> </LinearLayout>
Transition Code:
private void startActionActivity(int selectedRow, View animateFromView) { Intent intent = new Intent(this, ActionActivity.class); Action selectedAction = mAdapter.getActionAtPosition(selectedRow); intent.putExtra(Constants.SELECTED_ACTION_ID_KEY, selectedAction.id); if (animateFromView != null) { ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this, Pair.create(animateFromView, getResources().getString(R.string.transition_key_action)), Pair.create(animateFromView.findViewById(R.id.adapter_actionlist_toplabel), getResources().getString(R.string.transition_key_action_name)), Pair.create(animateFromView.findViewById(R.id.adapter_actionlist_bottomlabel), getResources().getString(R.string.transition_key_action_date))); startActivity(intent, options.toBundle()); } else { startActivity(intent); } }
source share