【android】代码改变ImageButton的位置

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);
}
posted @ 2016-02-13 17:00  Thkeer  阅读(928)  评论(0编辑  收藏  举报