0

My xml file:

   <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/layout_white"
    android:fitsSystemWindows="true">

    <androidx.constraintlayout.motion.widget.MotionLayout
        android:id="@+id/motion_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layoutDescription="@xml/scene_header"
        app:layout_scrollFlags="scroll|enterAlways|snap|exitUntilCollapsed">

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recyclerView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <include
            android:id="@+id/plantRecyclerView"
            layout="@layout/plant_rv_main"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clipToPadding="false"
            app:layout_constraintTop_toBottomOf="@id/recyclerView" />

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

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintLeft_toLeftOf="parent">

    <com.google.android.material.bottomappbar.BottomAppBar
        android:id="@+id/bottom_appbar"
        style="@style/Widget.MaterialComponents.BottomAppBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        app:fabAlignmentMode="center"
        app:fabAnimationMode="scale"
        app:fabCradleRoundedCornerRadius="50dp"
        app:navigationIcon="@drawable/ic_menu_black_24dp" />

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/addPlantFab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="@{() -> addPlantClick.onAddPlantClick()}"
        android:src="@drawable/add_plant"
        app:fabSize="normal"
        app:layout_anchor="@id/bottom_appbar"/>
    </androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

With this xml, FloatingActionButton disappears when I pause the application by clicking the Home button and resume the application again. However, FloatingActionButton becomes visible again when the MotionLayout process is complete.

The completed means that the process reaches 0.0 or 1.0

Also, I thought maybe the problem arises from application theme. So, this is the my application theme in styles.xml:

<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar.Bridge">

I used Bridge because I changed the application theme in the middle of the development phase. I don't know why this behaviour arises. Is there anyone faced with such a situation? What is my mistake?

Thank you for your answers...

K.tas
  • 214
  • 1
  • 3
  • 16

1 Answers1

0

It was related with app theme. For more information please comment this answer.

K.tas
  • 214
  • 1
  • 3
  • 16