android - Set CardView height programmatically -
I'm new to Android developer and I'm having trouble setting the minimum height of it.gmariotti. Cardslib.library.view.CardView
Programmically I create a new example of a CardView and set all the XML elements in the code, but it does not affect CardView. I do not want to increase cardwife from XML.
CardwidcatCardCode = getActivity ()); CatCard.setBackgroundColor (Color.green (0)); CatCard.setMinimumHeight (10); CatCard.setBottom (0); CatCard.setExpanded (wrong);
Increases the card view frame layout so that you can set the layout prompt. Try doing something like this:
cardview. LayoutParam LayoutPromos = (cardview layoutParam) catCard.getLayoutParams (); Layout Paste Heights = 10;
, do not forget this setting that settings width is also required. Or become new layout mercury (not tested):
Cardwit Cat Card = getApplicationContext ()); // Set width content and height 10 DP to wrap - & gt; CatCard.setLayoutParams (New CardView.LayoutParams (CardView.LayoutParams.WRAP_CONTENT, 10)); CatCard.setMinimumHeight (10);
Comments
Post a Comment