Home > other >  How can I remove unnecessary white background from gif?
How can I remove unnecessary white background from gif?

Time:01-11

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

enter image description here

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"
  •  Tags:  
  • Related