首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

RelativeLayout边界布局有关问题

2012-06-17 
RelativeLayout边界布局问题这么一段代码RelativeLayout lyUsernew RelativeLayout(this)lyUser.setId(l

RelativeLayout边界布局问题
这么一段代码
RelativeLayout lyUser=new RelativeLayout(this);
lyUser.setId(layUserID);
RelativeLayout.LayoutParams margin = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
margin.setMargins(15, 62, 15, 0);
lyUser.setLayoutParams(margin);

运行后Margin边界没反应

[解决办法]
RelativeLayout.LayoutParams margin = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
margin.leftMargin = x;
margin.topMargin = y;

热点排行