0

I'm using to recyclerview to display a list a images from a web service. I'm trying to display images in ImageView within CardView widget.Everything is working fine. All the images and lists are displaying properly. but when i try to run on Kitkat 4.4.4 its showing extra(Large) padding at top and bottom of image within the Cardview. I'm using ImageView only no text nothing.

Check the attached image.

on 4.4.4 enter image description here

on Lollipop enter image description here I've tried almost everything that i've found on SO so far. any help is appreciated. Thanks

XML code for Cardview

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_horizontal_margin_half">

<android.support.v7.widget.CardView
    android:layout_centerHorizontal="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/offwhite"
    android:id="@+id/cardlayout_malls"
    android:layout_marginLeft="@dimen/activity_horizontal_margin_half"
    card_view:cardUseCompatPadding="true"
    android:layout_marginRight="@dimen/activity_horizontal_margin_half">-->
    <!-- Thumbnail Image -->

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/bannerImageView"/>
    </android.support.v7.widget.CardView>
    </RelativeLayout>
Cheticamp
  • 61,413
  • 10
  • 78
  • 131
deejay
  • 572
  • 4
  • 18

2 Answers2

7

try this way

card_view:cardPreventCornerOverlap="false"

OR

in imageview you can use add this in your imageview

 <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true"
        android:id="@+id/bannerImageView"/>
Aditya Vyas-Lakhan
  • 13,409
  • 16
  • 61
  • 96
0

addcard_view:cardPreventCornerOverlap="false" Extra padding is because of those tiny round corners which, need to be disabled. Basically that is not a flaw rather a Design constraint!

Firoz Jaroli
  • 505
  • 5
  • 11