Android Vertical Shimmer

2.6k Views Asked by At

While navigating through Android Material Components, I came across this list loading animation.

enter image description here

I know a few libraries (e.g.ShimmerLayout, Facebook's Shimmer) which have horizontal loading animation. But it is not as smooth since it just renders the UI in a flash once you get the data. If you look at the animation in the video, it actually displays vertical shimmer and renders response one by one. I was wondering how can we achieve this effect.

1

There are 1 best solutions below

1
On

You can set top to bottom shimming direction using facebook shimmer

    val container:ShimmerFrameLayout = findViewById(R.id.shimmer_view_container)  

    val builder = Shimmer.AlphaHighlightBuilder()
    builder.setDirection(com.facebook.shimmer.Shimmer.Direction.TOP_TO_BOTTOM)
    container.setShimmer(builder.build())

did not test it but it should work