Android 卡片视图为其中的图像提供自动填充
我创建了一个卡片视图,如下所示:Android 卡片视图为其中的图像提供自动填充,android,android-xml,android-cardview,Android,Android Xml,Android Cardview,我创建了一个卡片视图,如下所示: <android.support.v7.widget.CardView android:id="@+id/card" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" card_view:cardBackgroundColor="#FF5722" android:layout
<android.support.v7.widget.CardView
android:id="@+id/card"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
card_view:cardBackgroundColor="#FF5722"
android:layout_width="fill_parent"
android:layout_height="135dp"
card_view:cardCornerRadius="5dp"
android:layout_marginTop="9dp"
android:layout_marginLeft="9dp"
android:layout_marginRight="9dp"
card_view:cardElevation="0.01dp"
android:layout_marginBottom="0dp"
card_view:cardPreventCornerOverlap="false"
card_view:cardUseCompatPadding="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<ImageView
android:id="@+id/imgv"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:src="@drawable/android"
/>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="7">
<TextView
android:id="@+id/textview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/textview2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="30dp"
/>
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
。它仍然不起作用
更新
更改安卓:layout\u height=“wrap\u content”而不是135 dp后,它工作得很好。但我想将其保持为135 dp。我如何才能做到这一点?尝试设置card\u view:carducecompatipadding=“false”,因为它会导致一些额外的填充。尝试设置card\u view:carducecompatipadding=“false”因为它会导致一些额外的填充。尝试移除cardView的边缘顶部。它增加了卡之间的额外间距。尝试删除cardView的边距。它增加了卡之间的额外间距。完全是虚构的、无背景的猜测。图像是完全适合那些135dp,还是稍微大一点?它完全适合你可以添加你的列表行xml吗?完全是虚构的,没有背景的猜测。图像是完全适合那些135dp,还是稍微大一点?它完全适合您可以添加列表行xml吗?