动态添加ImageView 设置setPadding不起作用问题

imageView = new ImageView(NavigationActivity.this);
imageView.setLayoutParams(new LayoutParams(12,12));
imageView.setPadding(20, 0, 20, 0);

设置ImageView的setPadding(20, 0, 20, 0); 不起作用

改为

LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(12, 12);
params.setMargins(0, 0,13, 0);
imageView = new ImageView(NavigationActivity.this);
imageView.setLayoutParams(params);

posted on 2013-04-10 13:11  freexiaoyu  阅读(9619)  评论(0编辑  收藏  举报