gabrielemariotti / cardslib

Android Library to build a UI Card
4.66k stars 1.19k forks source link

Remove bottom padding of CardView #557

Open candeiasdan opened 7 years ago

candeiasdan commented 7 years ago

I have some weird bottom padding of CardView. I would like my card to fit my inner layout.

My card view layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/card_main_layout"
    style="@style/card.main_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="8dp">

    <TextView
        android:id="@+id/operation"
        style="@style/settings_operation_title_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:text="Rate this app" />

    <TextView
        android:id="@+id/description"
        style="@style/settings_operation_subtitle_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:text="Rate this app" />
</LinearLayout>

Main Layout:

<ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <it.gmariotti.cardslib.library.view.CardView
            android:id="@+id/cardAbout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="12dp"
            android:layout_marginRight="12dp"
            android:layout_marginTop="12dp"/>

    </ScrollView>
bytehala commented 7 years ago

Have you tried specifying the left, right, and top padding on the card view layout? Maybe it's caused by android:padding="8dp" setting the padding on all 4 sides.