Android examples for User Interface:Layout
set View Layout Y
//package com.java2s; import android.view.View; import android.view.ViewGroup.MarginLayoutParams; import android.widget.RelativeLayout; public class Main { public static void setLayoutY(View view, int y) { MarginLayoutParams margin = new MarginLayoutParams( view.getLayoutParams()); margin.setMargins(margin.leftMargin, y, margin.rightMargin, y + margin.height);//from w w w. j a v a 2 s . c om RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( margin); view.setLayoutParams(layoutParams); } }