问题:
通过在回收站视图中使用cardview,它采用顶部和底部的默认边距。
Issue Image Link
如何为两者保持相同的保证金?
这是我的xml卡片布局
Me.DataGridView1.Columns("Date").DefaultCellStyle.Format = "dd/MM/yyyy"
我的回收站视图
<?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>
答案 0 :(得分:0)
在你的rowitem中执行以下操作:
<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:marginTop="2.5dp"
android:marginBottom="2.5dp"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
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"
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>
并在父布局中为您的recyclerview提供保证金:
<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"
layout_marginTop="2.5dp"
layout_marginBottom="2.5dp"
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"
android:background="@color/white"/>
</RelativeLayout>