RecyclerView с проблемами рендеринга MotionLayoit - PullRequest
0 голосов
/ 06 апреля 2020

Я пытаюсь использовать MotionLayout для создания аккуратной анимации Onswipe. Он работает, как задумано, но показывает черный цвет фона рециркулятора. также он меняет цвет EditText на серый. даже если я не установил никаких цветов. Примечание: ящик навигации будет добавлен вместе с нижней навигацией. Кроме того, я использую дублированные макеты для настройки переходов вместо использования тега

enter image description here

XML код:

<androidx.drawerlayout.widget.DrawerLayout 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"
tools:context=".activities.MainActivity">

<androidx.constraintlayout.motion.widget.MotionLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layoutDescription="@xml/activity_main_scene">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="0dp"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/colorPrimary"
        android:elevation="4dp"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:contentDescription="@string/welcome"
        android:scaleType="centerCrop"
        android:src="@drawable/background"
        app:layout_constraintBottom_toTopOf="@+id/recycler_view_markets"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/toolbar" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recycler_view_markets"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:backgroundTint="@color/colorWhite"
        android:orientation="horizontal"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="parent"
        tools:itemCount="1"
        tools:listitem="@layout/item_markets" />

    <LinearLayout
        android:id="@+id/drageLayout"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="@drawable/title_layout_bg"
        android:backgroundTint="@color/colorWhite"
        android:orientation="vertical"
        app:layout_constraintBottom_toBottomOf="@+id/imageView"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent">

        <TextView
            android:id="@+id/textView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center_horizontal"
            android:padding="2dp"
            android:text="@string/markets"
            android:textColor="@color/colorPrimary"
            android:textSize="30sp" />
    </LinearLayout>

    <androidx.cardview.widget.CardView
        android:id="@+id/cardView2"
        android:layout_width="0dp"
        android:layout_height="@dimen/dp50h"
        android:layout_margin="@dimen/dp10w"
        android:layout_marginStart="6dp"
        android:layout_marginEnd="6dp"
        app:cardCornerRadius="@dimen/dp5w"
        app:cardElevation="@dimen/dp5w"
        app:layout_constraintBottom_toTopOf="@+id/drageLayout"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/toolbar"
        app:layout_constraintVertical_bias="0.49">

        <EditText
            android:id="@+id/et_search"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="@dimen/dp5w"
            android:drawableEnd="@drawable/ic_search"
            android:gravity="center_vertical"
            android:hint="@string/hint_search_for_item"
            android:imeOptions="actionSearch"
            android:importantForAutofill="no"
            android:inputType="text" />
    </androidx.cardview.widget.CardView>

    <TextView
        android:id="@+id/quote"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:shadowColor="#FAF5F5"
        android:text="@string/quote_1"
        android:textColor="@color/colorWhite"
        android:textSize="30sp"
        app:layout_constraintBottom_toTopOf="@+id/cardView2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/toolbar" />


</androidx.constraintlayout.motion.widget.MotionLayout>

Код перехода:

<MotionScene xmlns:app="http://schemas.android.com/apk/res-auto">

<Transition
    app:constraintSetEnd="@layout/activity_main_end"
    app:constraintSetStart="@layout/activity_main_start"
    app:duration="1000">
    <OnSwipe
        app:dragDirection="dragUp"
        app:touchAnchorId="@id/drageLayout"
        app:touchAnchorSide="top" />
</Transition>

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...