public class MarginActivity extends Activity {
private TextView tv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.margin);
tv = ((TextView) findViewById(R.id.tv));
// alertMaginLeft1();
alertMaginLeft2();
}
/**
* 1 获取子view的getLayoutParams
* 2 拿到参数
* 3 重新设置
* 4 setLayoutParams
*/
在代码中设置margin
最新推荐文章于 2023-10-10 20:04:19 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)