android - How to set CardView's elevation programmatically? -
hello want set elevation of cardview programmatically seems not work , here's code :
cardview cardview = new cardview(this); linearlayout.layoutparams params = new linearlayout.layoutparams(linearlayout.layoutparams.match_parent,linearlayout.layoutparams.match_parent); cardview.setlayoutparams(params); linearlayout linearlayout = (linearlayout)findviewbyid(r.id.linear); cardview.setcardbackgroundcolor(color.white); cardview.setcardelevation(1000); linearlayout.addview(cardview);
even though setcardeleveation set 1000 there no changes cardview, what's wrong ? there related question out there can't got answer.
use cardview.setmaxcardelevation(8);
instead
Comments
Post a Comment