I made an app that displays images stored locally in a grid view.I used to use Picasso but i stopped using it due to many issues(It didn't load images on some devices).Then i switched to glide,everything is fine except that the image is stretched vertically. This causes scrolling issue.I never faced such an issue while using Picasso.How can i fix this issue ???
My MainActivity code-
Glide.with(MainActivity.this)
.load(mThumbIds[position])
.placeholder(R.raw.place_holder)
.error(R.raw.big_problem)
.centerCrop()
.into(imageView);
return imageView;
My activity_main.xml file code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:background="@color/colorPrimary"
android:layout_height="match_parent">
<GridView
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:columnWidth="150dp"
android:numColumns="2"
android:layout_above="@+id/adView" />
<com.google.android.gms.ads.AdView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/adView"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/banner_ad_unit_id"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
Screenshot of the problem-See the image on the right it is stretched vertically
I just found out. It's because size of placeholder image didn't match original image.
My solution was simply remove placeholder or resize your placeholder
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