我想在内容加载时显示列表项占位符,如: Faceook。我怎样才能做到这一点呢?

发布于 2016-09-16 17:26:32
据我所知,目前还没有针对Android的库,我可以写一个,但我很懒:)
所以我现在要做的就是在一个灰色背景的简单视图上使用facebook的这个漂亮的Schimering effect。
    <com.facebook.shimmer.ShimmerFrameLayout
    android:id="@+id/shimmer_view_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <View
        android:id="@+id/gallery_placeholder"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:layout_gravity="center"
        android:layout_margin="5dp"
        android:background="@android:color/darker_gray" />
    </com.facebook.shimmer.ShimmerFrameLayout>这对我很有效..。
发布于 2017-02-20 13:30:10
现在有一个基于Facebook Shimmer的名为ShimmerRecyclerview的新库
要使用它,您可以像这样定义您的xml回收器视图:
<com.cooltechworks.views.shimmer.ShimmerRecyclerView
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/shimmer_recycler_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:demo_child_count="10"
        app:demo_grid_child_count="2"
        app:demo_layout="@layout/layout_demo_grid"
        app:demo_layout_manager_type="grid"
        />demo_layout属性是模板占位符放置的位置。
要显示闪亮的布局,请调用:
shimmerRecycler.showShimmerAdapter();为了隐藏它:
shimmerRecycler.hideShimmerAdapter();https://stackoverflow.com/questions/36857713
复制相似问题