我使用了SharedElement Transition在recyclerView的onItemClick方法中进行DetailsActivity。但是,当单击位于底部的项目时,它首先进入BottomNavigationView顶部,然后发生过渡。 OnBackPressed相同。此外,它还可以在模拟器中使用机械键。如何解决?
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity.MainActivity"
android:id="@+id/main_activity"
>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/childofMain"
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation_view"
android:layout_marginTop="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_below="@+id/bottom_navigation_view">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="@null"
android:layout_below="@+id/mainRecyclerView"
>
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:titleEnabled="false"
app:expandedTitleMarginBottom="94dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:contentScrim="?colorPrimary"
android:layout_below="@+id/mainRecyclerView"
>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:id="@+id/toolbar_image"
app:layout_collapseMode="parallax"
/>
<ImageView android:layout_width="120dp"
android:layout_height="36dp"
android:id="@+id/mainOdulluDUzyazi"
android:layout_marginTop="40dp"
android:scaleType="fitCenter"
android:layout_gravity="center|top"
app:layout_collapseMode="parallax"
/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/trendyarismalar"
android:text="Trend Yarışmalar"
android:textColor="@color/white"
android:layout_gravity="center|top"
android:layout_marginTop="100dp"
android:textSize="20sp"
android:textStyle="bold"
app:layout_collapseMode="parallax"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mainRecyclerView"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:background="@null"
android:layout_gravity="bottom"
app:behavior_overlapTop="150dp"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:layout_below="@+id/bottom_navigation_view"
/>
</android.support.design.widget.CoordinatorLayout>
<com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
android:id="@+id/bottom_navigation_view"
android:layout_width="match_parent"
android:layout_height="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/bottom_navigation_menu"
android:background="?android:attr/windowBackground"
app:itemIconTint="@drawable/nav_item_color_state"
app:itemIconSize="25dp"
app:layout_constraintCircleRadius="5dp"
app:labelVisibilityMode="unlabeled"
>
</com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx>
`
答案 0 :(得分:0)
您可以尝试使用它;
<item name="android:windowSharedElementsUseOverlay">false</item>
注意:将此行放入styles.xml文件中您的应用程序基础主题。