📜  以编程方式设置 cardview 边距 - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:13.659000             🧑  作者: Mango

代码示例1
ViewGroup.MarginLayoutParams layoutParams = 
                           (ViewGroup.MarginLayoutParams) myCardView.getLayoutParams();
    layoutParams.setMargins(0, 0, SystemHelper.dpToPx(2), 0);
    myCardView.requestLayout();