android的
checkLine.setBackgroundResource(R.drawable.bg_rectangle);
设置背景后出现padding失效的问题
方式一 先获取checkLine的padding值 在setBackgroundResource()之后增加 setPadding 代码
int left = checkLine.getPaddingLeft();
int right = checkLine.getPaddingRight();
int top = checkLine.getPaddingTop();
int bottom = checkLine.getPaddingBottom();
checkLine.setBackgroundResource(R.drawable.bg_rectangle);
checkLine.setPadding(int left, int top, int right, int bottom)
方拾二 : 在子View中加margin控制内容和边界 的间距,亲测可行,记录下