Android ImageView not displaying correctly

32 views Asked by At

enter image description hereDoes any one else have this issue? Sometime when my images are downloaded from the api, I display them in an image view using : binding?.imgView?.setImageBitmap(it)

Some times when the image is displayed in the image view, half of it is cut off. how do I fix it? See image?

android:scaleType="fitXY", other scale types aren't valid for my app meaning this is the one I want to use. I know this is stretching the image but why doesn't the system display properly? is the common? should I reload the imageView? if so, what is the best way.

 <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/layout_parent"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/transparent">

        <androidx.cardview.widget.CardView
            android:id="@+id/card_view"
            android:visibility="visible"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:cardUseCompatPadding="true"
            app:cardPreventCornerOverlap="false"
            app:cardCornerRadius="8dp"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent">
           <com.appnaq.adventures.mystatis.views.generic.GenericImageView
                android:id="@+id/img_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="fitXY"
                android:background="@android:color/black" />
        </androidx.cardview.widget.CardView>
    </androidx.constraintlayout.widget.ConstraintLayout>
0

There are 0 answers