CardView extends FrameLayout, so you must install LayoutParams. Try something like this:
CardView.LayoutParams layoutParams = (CardView.LayoutParams) catCard.getLayoutParams(); layoutParams.height = 10;
Do not forget that setting the width is also required. Or create new LayoutParams like this (not tested):
CardView catCard = new CardView(getApplicationContext()); // sets width to wrap content and height to 10 dp -> catCard.setLayoutParams(new CardView.LayoutParams( CardView.LayoutParams.WRAP_CONTENT, 10)); catCard.setMinimumHeight(10);
A honey bustard
source share