Android examples for android.widget:RelativeLayout
set Relative Layout Size
import android.view.ViewGroup; import android.widget.RelativeLayout; public class Main { public static void setRelativeLayoutSize(RelativeLayout relativeLayout, int screenWidth) { ViewGroup.LayoutParams layoutParams = null; try {/*w ww . j a va 2 s .c o m*/ layoutParams = relativeLayout.getLayoutParams(); } catch (Exception e) { e.printStackTrace(); } layoutParams.width = screenWidth; layoutParams.height = screenWidth; relativeLayout.setLayoutParams(layoutParams); } }