I wanna to set a custom image to "Profile" item in the BottomNavigationView as the user is logged in. I have user's image URL.
This is the suggested design
I used this code for make it works. (Kotlin)
navigation is the BottomNavigationView
val menu = navigation.menu
val menuItem = menu.findItem(R.id.my_account)
Glide.with(this)
.asBitmap()
.load("https://my_account_image_url")
.apply(RequestOptions
.circleCropTransform()
.placeholder(R.drawable.ic_avatar))
.into(object : SimpleTarget<Bitmap>() {
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
menuItem?.icon = BitmapDrawable(resources, resource)
}
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With