我在设置边距时遇到了一些问题!
body_content = (LinearLayout) findViewById(R.id.body_content);
int gSLength = 2;
body_content.setPadding(10, 0, 10, 0);
for (int i = 0; i < 1; i++){
FrameLayout fl = new FrameLayout(this);
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, 90);
fl.setLayoutParams(params);
LinearLayout ll1 = new LinearLayout(this);
LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 30);
params1.setMargins(0, 60, 0, 0);
ll1.setLayoutParams(params1);
ll1.setBackgroundDrawable(getResources().getDrawable(R.drawable.line_down));
fl.addView(ll1);
body_content.addView(fl);
}
这没用params1.setMargins (0, 60, 0, 0);