0

I'm making an android app with cards UI, by using the library: https://github.com/gabrielemariotti/cardslib

I want to make a custom card which will be smaller than the default card size. Is there any way to do this?

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Priyan
  • 1
  • 2
  • Just a heads up - [`CardView`](https://developer.android.com/preview/material/ui-widgets.html#cardview) is now the canonical Android card view. – Sean Barbeau Oct 07 '14 at 20:24

1 Answers1

2

The default card has a min height.

You can override this value in your dimens.xml:

<dimen name="card_base_empty_height">96dp</dimen>
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
  • This will change the minHeight of all cards. How can I set the minHeight of only a specific card? –  Oct 02 '15 at 21:37
  • **Answer:** In my case, I used a [custom card-layout](https://github.com/gabrielemariotti/cardslib/blob/master/doc/CARD.md#use-your-custom-card-layout) as specified in the documentation. I changed `android:layout_height` to my desired value. However my initial intention was to change the height based on a `ImageView` in the custom card-layout. For this, I added `android:adjustViewBounds="true"`. Another solution would bet to get the `ImageView` height [programmaticaly](http://stackoverflow.com/questions/4680499/how-to-get-the-width-and-height-of-an-android-widget-imageview). –  Oct 02 '15 at 22:14