I got unnecessary white background with square box while loading with Glide.
Below are the code
<ImageView
android:id="@ id/ivLogo"
android:layout_width="100dp"
android:layout_height="100dp"
android:contentDescription="@string/loading"
android:gravity="center"
android:src="@drawable/bg_loader"/>
Glide.with(this).load(R.drawable.bg_loader)
.fitCenter()
.apply(
RequestOptions().placeholder(R.drawable.bg_loader)
.centerCrop()
)
.into(ivLogo)
Here is the screenshot
Also I tried the below code
<ImageButton
android:id="@ id/ivLogo"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:scaleType="centerInside"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/bg_loader"
tools:ignore="ContentDescription" />
CodePudding user response:
Instead of <ImageButton> use <ImageView>.
CodePudding user response:
You could try to replace
android:background="?attr/selectableItemBackgroundBorderless"
with
android:background="@null"