public static void setLayout(View view,int x,int y)
{
ViewGroup.MarginLayoutParams margin=new ViewGroup.MarginLayoutParams(view.getLayoutParams());
//margin.setMargins(x,y, x+margin.width, y+margin.height);
Log.d("xy",""+margin.width+" "+margin.height);
margin.setMargins(x,y, 0, 0);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(margin);
view.setLayoutParams(layoutParams);
}
转载于:https://www.cnblogs.com/Thkeer/p/5188071.html