問題:
リサイクルビューでcardviewを使用すると、上部と下部のデフォルトの余白が取られます。 Issue Image Linkアンドロイドカードビューのマージンの下端がデフォルトよりも大きい
両方で同じマージンを維持する方法は?
は、ここではカードレイアウトの私のxmlあなたrowitemで
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/cardcolor"
android:orientation="vertical"
>
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
card_view:cardElevation="0dp"
card_view:cardPreventCornerOverlap="false"
android:foreground="?android:attr/selectableItemBackground"
card_view:cardCornerRadius="2dp"
card_view:contentPadding="10dp"
card_view:cardUseCompatPadding="false" >
..//body
</android.support.v7.widget.CardView>
</LinearLayout>
マイリサイクラービュー
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".HomePageActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
layout_marginBottom="5dp"
android:background="@color/white"/>
</RelativeLayout>
@PiyushGupta私は最近、このサイトを参照して追加しました。取り外した後もまだ効果がありません。 –
ちょうどあなたのRecyclerListViewの5dpのパディングを与えると、完全なアイテムが10dpの同じパディングを持つことがわかります –
また、cardviewの余白も変更されましたか? – Drv