Library: implementation 'com.google.android.material:material:1.0.0'
XML:
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dimen_16_dp"
android:visibility="visible"
app:fabCustomSize="80dp"
app:maxImageSize="80dp"
android:scaleType="center"
android:layout_alignParentEnd="true"
android:layout_above="@id/layout_privacycardview"
android:padding="0dp"
android:src="@drawable/ic_football" />
Now, I want to set the image resource programmatically as well as dynamically using Glide.
String url = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSyKmXIim9sp4B4Mn1N_NJtRkzvkStZo_s5pA&usqp=CAU";
Glide.with(HomeScreenActivity.this).load(url).into(fab);
Output:
How to set the image resource dynamically using Glide, such that it can have its proper imageSize etc.