0

I am trying to set the card size smaller in my activity but not sure how because how it references it(card:card_layout_resourceID="@layout/card_thumbnail_layout").

So my question is how do I use this library but change the height of the below card?

Here is a card

    <it.gmariotti.cardslib.library.view.CardView
        android:id="@+id/carddemo"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        card:card_layout_resourceID="@layout/card_thumbnail_layout"
        android:layout_below="@+id/currentTerm"
        />

@layout/card_thumbnail_layout:(cant edit this because its in the build folder)

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:card="http://schemas.android.com/apk/res-auto"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="wrap_content">

    <!-- Card visible layout -->
    <LinearLayout
        android:id="@+id/card_main_layout"
        style="@style/card.main_layout"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >

        <!-- Compound view for Header Card
             If you want to customize this element use attr card:card_header_layout_resourceID
             You can also use your CardHeader subclass-->
        <it.gmariotti.cardslib.library.view.component.CardHeaderView
            style="@style/card.header_outer_layout"
            android:id="@+id/card_header_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

        <LinearLayout
            android:id="@+id/card_thumb_and_content_layout"
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <it.gmariotti.cardslib.library.view.component.CardThumbnailView
                style="@style/card_thumbnail_outer_layout"
                android:id="@+id/card_thumbnail_layout"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"/>

            <!-- Main Content View -->
            <FrameLayout
                android:id="@+id/card_main_content_layout"
                style="@style/card.content_outer_layout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>

        </LinearLayout>

    </LinearLayout>

    <!-- Compound view for Shadow
         If you want to customize this element use attr card:card_shadow_layout_resourceID -->
    <it.gmariotti.cardslib.library.view.component.CardShadowView
        style="@style/card.shadow_outer_layout"
        android:id="@+id/card_shadow_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

    <!-- Expand layout. You can customize this element with your CardExpand class -->
    <FrameLayout
        android:id="@+id/card_content_expand_layout"
        style="@style/card.main_contentExpand"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >
    </FrameLayout>

</LinearLayout>
BluGeni
  • 3,378
  • 8
  • 36
  • 64
  • Possible duplicate of [Android Card UI : card resize (gabrielemariotti)](http://stackoverflow.com/questions/25907697/android-card-ui-card-resize-gabrielemariotti) –  Oct 02 '15 at 21:26

1 Answers1

0

The default card has a minimum height, as specified in the documentation.

Therefore you need to add:

<item name="android:minHeight">your_value_in_dp</item>

in

style name="card.content_outer_layout"

This approach ends in setting the minHeight of all cards. However, if you want to set a height to a specific card you could first build a custom card-layout and set android:adjustViewBounds="true" in your ImageView. For more details and other solutions, see this question.

Community
  • 1
  • 1