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

❓ ❓ ❓ How to show shining or glare/mirror/shimmer/shine effect on a view ❓ ❓ ❓ #120

Closed omkar-tenkale closed 2 years ago

omkar-tenkale commented 2 years ago
        Shimmer.ColorHighlightBuilder colorHighlightBuilder = new Shimmer.ColorHighlightBuilder();
        colorHighlightBuilder.setHighlightColor(getResources().getColor(R.color.colorWhite));
        colorHighlightBuilder.setHighlightAlpha(0.3f);
        colorHighlightBuilder.setRepeatCount(0);
        colorHighlightBuilder.setBaseAlpha(0);
        ui.shimmerContainer.setShimmer(colorHighlightBuilder.build());
        ui.shimmerContainer.startShimmer();
        <FrameLayout
            android:id="@+id/actionRoot"
            android:background="@drawable/bg_round_button_green"
            android:layout_margin="8dp"
            android:layout_width="match_parent"
            android:layout_height="48dp" >

            <TextView
                android:textColor="@color/white"
                android:id="@+id/action"
                android:gravity="center"
                android:textSize="16dp"
                android:text="CHARGE  $ 232.23"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

            <com.facebook.shimmer.ShimmerFrameLayout
                android:id="@+id/shimmerContainer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <View
                    android:background="#000"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"/>
            </com.facebook.shimmer.ShimmerFrameLayout>

        </FrameLayout>

ezgif com-gif-maker

Avoid this:

    <com.facebook.shimmer.ShimmerFrameLayout
            android:id="@+id/shimmerContainer"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <TextView
                android:textColor="@color/white"
                android:id="@+id/action"
                android:gravity="center"
                android:textSize="16dp"
                android:text="CHARGE  $ 232.23"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
        </com.facebook.shimmer.ShimmerFrameLayout>
omkar-tenkale commented 2 years ago

Self answered for helping others :)