注意点:
1.不能给view new ViewGroup.LayoutParams 对象,会出现cast 异常
2.在设置 ViewGroup.MarginLayoutParams 的 left / top /right/bottom时候,必须设置 left/top,不然仅仅设置 right/bottom时候是不起作用的
使用:
ViewGroup.LayoutParams pm =this.getLayoutParams();
ViewGroup.MarginLayoutParams mpm = (ViewGroup.MarginLayoutParams) pm;
mpm.leftMargin = value;
网友评论