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);

How to show multiple cardview
ReplyDelete