这里是代码
CardView.LayoutParams layoutParams = new CardView.LayoutParams(
CardView.LayoutParams.WRAP_CONTENT, CardView.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(100,100,100,100);
CardView cv = new CardView(this);
cv.setLayoutParams(layoutParams);
无论在哪里,从xml中使用它都可以工作。
android:layout_marginLeft="100dp"
可能的原因是什么?我有所遗漏吗!
我需要为cardview的海拔高度添加边距。
谢谢。