dee*_*jay 0 android padding android-layout android-imageview android-cardview
我正在使用recyclerview来显示来自Web服务的图像列表。我正在尝试在CardView小部件中的ImageView中显示图像。一切正常。所有图像和列表均显示正确。但是当我尝试在Kitkat 4.4.4上运行时,它在Cardview内图像的顶部和底部显示多余的(大)填充。我正在使用ImageView只没有文本什么都没有。
检查附件图像。
在棒棒糖上
到目前为止,我已经尝试了几乎所有我发现的东西。任何帮助表示赞赏。谢谢
Cardview的XML代码
<?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>
Run Code Online (Sandbox Code Playgroud)
尝试这种方式
card_view:cardPreventCornerOverlap="false"
Run Code Online (Sandbox Code Playgroud)
要么
在imageview中,您可以使用将其添加到imageview中
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:id="@+id/bannerImageView"/>
Run Code Online (Sandbox Code Playgroud)