Created
October 21, 2022 16:17
-
-
Save BracketCove/013a999ed211d8a6281437799d5dfb8b to your computer and use it in GitHub Desktop.
Easy animated loading spinner with Glide (or whatever image loading library)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//use this in your Recyclerview or whereever for asynchornous image loading | |
Glide.with(holder.itemView.context) | |
.load(avatarUrl) | |
.centerCrop() | |
.placeholder( | |
CircularProgressDrawable(holder.itemView.context).apply { | |
setColorSchemeColors( | |
ContextCompat.getColor(holder.itemView.context, R.color.colorPrimary) | |
) | |
strokeWidth = 2f | |
centerRadius = 10f | |
start() | |
} | |
) | |
.into(holder.avatar) | |
// Add this to build.gradle (app/sub-project level) and adjust version accordingly: | |
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment