A MarginLayoutParams Error
Code:
ViewGroup.MarginLayoutParams lp = new ViewGroup.MarginLayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
Error:
should pass resolved pixel dimension instead of resource id here:getResource().getDimession*(ViewGroup.LayoutParams.WRAP_CONTENT)
MATCH_PARENT 和 WRAP_CONTENT 其实是 MarginLayoutParams 构造函数的合法参数. 按Alt + Enter忽略代码检测即可。