Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 片段中的共享元素不起作用,textview->;编辑文本_Android_Android Layout_Android Fragments - Fatal编程技术网

Android 片段中的共享元素不起作用,textview->;编辑文本

Android 片段中的共享元素不起作用,textview->;编辑文本,android,android-layout,android-fragments,Android,Android Layout,Android Fragments,我有两个片段,希望在它们之间进行共享元素转换。 带有适配器的recyclerview中的项包含一个textview,该textview应在下一个片段中设置为edittext的动画。 回收视图也在一个片段中 这是我的密码: 来自适配器的viewholder的项目布局: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/row_container" androi

我有两个片段,希望在它们之间进行共享元素转换。 带有适配器的recyclerview中的项包含一个textview,该textview应在下一个片段中设置为edittext的动画。 回收视图也在一个片段中

这是我的密码:

来自适配器的viewholder的项目布局:

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/row_container"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:background="#FAFAFA"
android:elevation="0dp"
>
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="?android:attr/selectableItemBackground"
    android:elevation="0dp"
    >
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginBottom="5dp"
        android:elevation="0dp"
        >


        <RelativeLayout
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:background="@null"
            android:elevation="0dp"
            android:layout_centerVertical="true"
            >

            <ImageButton
                android:id="@+id/notify_btn"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:src="@drawable/ic_bookmark_black_24dp"
                android:background="@null"
                android:tint="#9E9E9E"
                android:layout_centerInParent="true"
                />

        </RelativeLayout>


        <TextView
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="40dp"
            android:layout_marginRight="20dp"
            android:textSize="18sp"
            android:textStyle="bold"
            android:textColor="@android:color/black"
            android:layout_alignParentTop="true"
            android:maxLines="1"
            android:ellipsize="end"

            android:transitionName="title"
            />

        <TextView
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/text"
            android:layout_below="@id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="40dp"
            android:layout_marginRight="20dp"
            android:textSize="15sp"
            android:maxLines="2"
            android:layout_alignParentBottom="true"
            android:textColor="@android:color/black"
            android:ellipsize="end"

            android:transitionName="text"
            />

    </RelativeLayout>

    <ImageView
        android:id="@+id/fav"
        android:layout_width="15dp"
        android:layout_height="15dp"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_margin="5dp"
        android:visibility="invisible"
        android:src="@drawable/ic_star_black_24dp"
        />

</RelativeLayout>
最终片段的布局:

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible"
>

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginLeft="15dp"
    android:layout_marginRight="10dp"
    android:padding="10dp"
    >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        >

        <EditText
            android:id="@+id/title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textStyle="bold"
            android:nextFocusForward="@id/text"
            android:imeOptions="actionNext"
            android:singleLine="true"
            android:ems="16"
            android:hint="@string/title"
            android:textColor="#212121"
            android:textColorHint="#757575"
            android:background="@null"
            android:layout_marginTop="5dp"
            android:layout_marginBottom="5dp"
            android:scrollbars="horizontal"

            android:transitionName="title"
            />

        <EditText
            android:id="@+id/text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/text"
            android:textColor="#212121"
            android:textColorHint="#757575"
            android:background="@null"
            android:layout_marginLeft="2dp"

            android:transitionName="text"
            />

        <View
            android:id="@+id/line"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_marginTop="15dp"
            android:layout_marginBottom="15dp"
            android:elevation="0dp"
            android:background="@color/grey"
            />

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            >

            <ImageButton
                android:id="@+id/fav"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_star_black_24dp"
                android:layout_alignParentRight="true"
                android:layout_centerVertical="true"
                android:padding="5dp"
                android:background="?android:attr/selectableItemBackground"
                android:tint="#9E9E9E"
                />


        </RelativeLayout>
    </LinearLayout>
</ScrollView>

<android.support.design.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:gravity="top"
    android:id="@+id/snackbar">
</android.support.design.widget.CoordinatorLayout>

textview不会设置为edittext的动画。 此时将显示“爆炸”动画。 活动之间的动画作品。 有没有关于如何修复的建议

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible"
>

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginLeft="15dp"
    android:layout_marginRight="10dp"
    android:padding="10dp"
    >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        >

        <EditText
            android:id="@+id/title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textStyle="bold"
            android:nextFocusForward="@id/text"
            android:imeOptions="actionNext"
            android:singleLine="true"
            android:ems="16"
            android:hint="@string/title"
            android:textColor="#212121"
            android:textColorHint="#757575"
            android:background="@null"
            android:layout_marginTop="5dp"
            android:layout_marginBottom="5dp"
            android:scrollbars="horizontal"

            android:transitionName="title"
            />

        <EditText
            android:id="@+id/text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/text"
            android:textColor="#212121"
            android:textColorHint="#757575"
            android:background="@null"
            android:layout_marginLeft="2dp"

            android:transitionName="text"
            />

        <View
            android:id="@+id/line"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_marginTop="15dp"
            android:layout_marginBottom="15dp"
            android:elevation="0dp"
            android:background="@color/grey"
            />

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            >

            <ImageButton
                android:id="@+id/fav"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_star_black_24dp"
                android:layout_alignParentRight="true"
                android:layout_centerVertical="true"
                android:padding="5dp"
                android:background="?android:attr/selectableItemBackground"
                android:tint="#9E9E9E"
                />


        </RelativeLayout>
    </LinearLayout>
</ScrollView>

<android.support.design.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:gravity="top"
    android:id="@+id/snackbar">
</android.support.design.widget.CoordinatorLayout>