This repository was archived by the owner on Aug 1, 2023. It is now read-only.
Description ShimmerDrawable not working with View.LAYER_TYPE_HARDWARE and View.LAYER_TYPE_SOFTWARE.
Environment: Android emulator, Pixel 4 api 31
Shimmer shimmer = new Shimmer .ColorHighlightBuilder ()
.setBaseAlpha (0.7f )
.setHighlightAlpha (0.9f )
.setDuration (10000 )
.setDirection (Shimmer .Direction .TOP_TO_BOTTOM )
.setAutoStart (true )
.build ();
ShimmerDrawable shimmerDrawable = new ShimmerDrawable ();
shimmerDrawable .setShimmer (shimmer );
ShimmerDrawable shimmerDrawable2 = new ShimmerDrawable ();
shimmerDrawable2 .setShimmer (shimmer );
ShimmerDrawable shimmerDrawable3 = new ShimmerDrawable ();
shimmerDrawable3 .setShimmer (shimmer );
appCompatImageView .setLayerType (View .LAYER_TYPE_NONE , null );
appCompatImageView .setImageDrawable (shimmerDrawable );
appCompatImageView2 .setLayerType (View .LAYER_TYPE_HARDWARE , null );
appCompatImageView2 .setImageDrawable (shimmerDrawable2 );
appCompatImageView3 .setLayerType (View .LAYER_TYPE_SOFTWARE , null );
appCompatImageView3 .setImageDrawable (shimmerDrawable3 );
<LinearLayout xmlns : android =" http://schemas.android.com/apk/res/android"
xmlns : tools =" http://schemas.android.com/tools"
android : layout_width =" match_parent"
android : layout_height =" match_parent"
android : orientation =" vertical" >
<TextView
android : layout_width =" wrap_content"
android : layout_height =" wrap_content"
android : text =" LAYER_TYPE_NONE" />
<androidx .appcompat.widget.AppCompatImageView
android : id =" @+id/appCompatImageView"
android : layout_width =" 100dp"
android : layout_height =" 100dp" />
<TextView
android : layout_width =" wrap_content"
android : layout_height =" wrap_content"
android : text =" LAYER_TYPE_HARDWARE" />
<androidx .appcompat.widget.AppCompatImageView
android : id =" @+id/appCompatImageView2"
android : layout_width =" 100dp"
android : layout_height =" 100dp" />
<TextView
android : layout_width =" wrap_content"
android : layout_height =" wrap_content"
android : text =" LAYER_TYPE_SOFTWARE" />
<androidx .appcompat.widget.AppCompatImageView
android : id =" @+id/appCompatImageView3"
android : layout_width =" 100dp"
android : layout_height =" 100dp" />
</LinearLayout >
Reactions are currently unavailable
ShimmerDrawable not working with View.LAYER_TYPE_HARDWARE and View.LAYER_TYPE_SOFTWARE.
Environment: Android emulator, Pixel 4 api 31