facebookarchive / shimmer-android

An easy, flexible way to add a shimmering effect to any view in an Android app.
http://facebook.github.io/shimmer-android/
Other
5.31k stars 698 forks source link

ShimmerLayout hides GridLayout #79

Closed mecoFarid closed 5 years ago

mecoFarid commented 5 years ago

I'm using latest version 0.4.0. I was expecting to have shimmer applied to all layouts, but there seems to be a problem with GridLayout. GridLayout is totally hidden from view hierarchy when inside ShimmerLayout. Am I missing out something or it's expected behaviour?

Code to reproduce:


<?xml version="1.0" encoding="utf-8"?>
<com.facebook.shimmer.ShimmerFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:grid="http://schemas.android.com/tools"
    android:id="@+id/shimmer_loader_account"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:shimmer_duration="1500">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <de.hdodenhof.circleimageview.CircleImageView
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="@dimen/dimension_32dp"
            android:src="@drawable/bg_shimmer_loader_account_image"/>

        <View
            android:layout_width="170dp"
            android:layout_height="@dimen/height_thick_shimmer_text"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="@dimen/activity_vertical_margin"
            android:background="@color/colorShimmerViewBackground"/>

        <View
            android:layout_width="110dp"
            android:layout_height="@dimen/height_thick_shimmer_text"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="@dimen/dimension_8dp"
            android:background="@color/colorShimmerViewBackground"/>

        <android.support.v7.widget.GridLayout
            android:layout_width="250dp"
            android:layout_height="250dp"
            android:layout_marginTop="@dimen/dimension_32dp"
            grid:alignmentMode="alignBounds"
            android:layout_gravity="center_horizontal"
            app:columnCount="2"
            app:rowCount="2">

            <View android:layout_width="0dp"
                android:layout_height="0dp"
                grid:layout_columnWeight="1"
                grid:layout_rowWeight="1"
                grid:layout_gravity="fill"
                android:background="@drawable/bg_shimmer_loader_squircle"/>

            <View android:layout_width="0dp"
                android:layout_height="0dp"
                grid:layout_columnWeight="1"
                grid:layout_rowWeight="1"
                grid:layout_gravity="fill"
                android:background="@drawable/bg_shimmer_loader_squircle"/>

            <View android:layout_width="0dp"
                android:layout_height="0dp"
                grid:layout_columnWeight="1"
                grid:layout_rowWeight="1"
                grid:layout_gravity="fill"
                android:background="@drawable/bg_shimmer_loader_squircle"/>

            <View android:layout_width="0dp"
                android:layout_height="0dp"
                grid:layout_columnWeight="1"
                grid:layout_rowWeight="1"
                grid:layout_gravity="fill"
                android:background="@drawable/bg_shimmer_loader_squircle"/>

        </android.support.v7.widget.GridLayout>

    </LinearLayout>

</com.facebook.shimmer.ShimmerFrameLayout>