CardView in Sketchware

 

Code:

androidx.cardview.widget.CardView cv = new androidx.cardview.widget.CardView(MainActivity.this);

LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);

lp.setMargins(30,30,30,30);

cv.setLayoutParams(lp);

cv.setCardBackgroundColor(Color.WHITE);

cv.setRadius(15);

cv.setCardElevation(8);

cv.setMaxCardElevation(12);

cv.setPreventCornerOverlap(true);

((ViewGroup)_view.getParent()).removeView(_view);

linear1.removeAllViews();

linear1.addView(cv);

cv.addView(_view);

Comments

Post a Comment

Popular posts from this blog

Background video in Sketchware