动态按钮代码:
final Button button = new Button(this);
LinearLayout l = new LinearLayout(this);
l.setOrientation(LinearLayout.HORIZONTAL);
Resources resources = SecondActivity.this.getResources();
Drawable drawable = resources.getDrawable(R.drawable.buttonpg);
button.setBackgroundDrawable(drawable);
button.setText(String.valueOf(i));
button.setText(" " + nameArray[i]);
button.setId(i);
button.setWidth(180);
button.setHeight(60);
button.setTextColor(Color.rgb(255,69,0));
button.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD_ITALIC);
button.setGravity(Gravity.CENTER);
如何为此按钮添加 Margintop ....
谢谢你的帮助....