动态设置view的padding和margin值
1.动态设置padding,拿ImageView为例:
- ImageView imageView = new ImageView(Context context);
- imageView.setPadding(left,top,right,bottom);
拿LinearLayout里边放ImageVIew例
- LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(20, 20);
- params.setMargins(20, 0, 20, 0);
- imageView.setLayoutParams(params);
静以修身,俭以养德。
posted on 2016-09-28 16:04 miaozhenzhong 阅读(2300) 评论(0) 编辑 收藏 举报