Android examples for User Interface:Layout
set View Layout X
//package com.java2s; import android.view.View; import android.view.ViewGroup.MarginLayoutParams; import android.widget.RelativeLayout; public class Main { public static void setLayoutX(View view, int x) { MarginLayoutParams margin = new MarginLayoutParams( view.getLayoutParams()); margin.setMargins(x, margin.topMargin, x + margin.width, margin.bottomMargin);//from w w w . j av a 2 s . c o m RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( margin); view.setLayoutParams(layoutParams); } }