Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have an activity that contains 2 fragments

StepsFragment contains a Recyclerview but the Recyclerview's animation is not working

XML
<pre><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="400dp"
android:background="#B3D1DB"
tools:context=".StepsFragment">

<TextView
    android:id="@+id/inputEntred"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="TextView"
    android:visibility="invisible" />

<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/RV"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipToPadding="false"
    android:layoutAnimation="@anim/layou_animation_fall_down"
    android:paddingTop="10dp"
    android:paddingBottom="30dp" />

layou-animation-fall-down

XML
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
    android:animation="@anim/fall_down"
     android:animationOrder="normal"
       android:delay="15%">


fall-down

XML
<set xmlns:android="http://schemas.android.com/apk/res/android" android:duration="6000">
        <translate
            android:fromYDelta="-20%"
            android:interpolator="@android:anim/accelerate_decelerate_interpolator"
            android:toYDelta="0"
            android:duration="1000" />
     <alpha
     android:fromAlpha="0"
     android:interpolator="@android:anim/accelerate_decelerate_interpolator"
     android:toAlpha="3"
         android:duration="1000"
     />
  <scale
      android:fromXScale="105%"
      android:fromYScale="105%"
      android:interpolator="@android:anim/accelerate_decelerate_interpolator"
      android:pivotX="50%"
      android:pivotY="50%"
      android:toXScale="100%"
      android:toYScale="100%" android:duration="1000"
      />
</set>

activity layout
XML
<androidx.constraintlayout.widget.ConstraintLayout 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=".Sorting_activity">


<RelativeLayout
    android:id="@+id/triLayout"
    android:layout_width="0dp"
    android:layout_height="300dp"
    app:layout_constraintBottom_toTopOf="@+id/stepsLayout"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.0"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.0">

</RelativeLayout>

<androidx.coordinatorlayout.widget.CoordinatorLayout
    android:id="@+id/stepsLayout"
    android:layout_width="0dp"
    android:layout_height="0dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/triLayout"></androidx.coordinatorlayout.widget


What I have tried:

the animation works when the activity opens the fragment in a new page , but not when the fragment is inside the activity
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900