Closed raghavsatyadev closed 4 years ago
Code for showing animation
RecyclerViewSkeletonScreen skeletonScreen = Skeleton.bind(viewHolder.listSchedule) .adapter(scheduleListAdapter) .load(R.layout.item_schedule) .show();
Hiding it skeletonScreen.hide();
skeletonScreen.hide();
Item Layout File
<?xml version="1.0" encoding="utf-8"?> <com.google.android.material.card.MaterialCardView 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:id="@+id/box_item_schedule" android:layout_width="match_parent" android:layout_height="100dp" android:layout_margin="@dimen/space_5" android:clipToPadding="false" app:cardCornerRadius="@dimen/space_10" app:cardElevation="@dimen/space_5" app:cardPreventCornerOverlap="true" tools:cardBackgroundColor="@color/com_facebook_blue"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="match_parent"> <androidx.appcompat.widget.AppCompatTextView android:id="@+id/txt_schedule_time" android:layout_width="0dp" android:layout_height="wrap_content" android:paddingStart="@dimen/space_20" android:paddingTop="@dimen/space_20" android:paddingEnd="@dimen/space_20" android:shadowColor="@android:color/black" android:shadowDx="3" android:shadowDy="3" android:shadowRadius="5" android:textAppearance="?textAppearanceListItemSecondary" android:textColor="@android:color/white" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" tools:text="@tools:sample/date/hhmmss" /> <androidx.appcompat.widget.AppCompatTextView android:id="@+id/txt_schedule_title" android:layout_width="0dp" android:layout_height="wrap_content" android:paddingStart="@dimen/space_20" android:paddingEnd="@dimen/space_20" android:paddingBottom="@dimen/space_20" android:shadowColor="@android:color/black" android:shadowDx="3" android:shadowDy="3" android:shadowRadius="5" android:textAppearance="?textAppearanceListItem" android:textColor="@android:color/white" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" tools:text="Hello How Are You?" /> </androidx.constraintlayout.widget.ConstraintLayout> </com.google.android.material.card.MaterialCardView>
Don't use the cardview how your skeleton, use the ConstraintLayout inside. It's works for me.
yes I did that finally
Please see the GIF attached
Code for showing animation
Hiding it
skeletonScreen.hide();
Item Layout File