Java tutorial
//package com.java2s; import android.view.View; import android.view.ViewGroup; public class Main { public static void setHeight(View view, int height) { if (view == null || view.getLayoutParams() == null) { throw new IllegalArgumentException("View LayoutParams is null"); } ViewGroup.LayoutParams params = view.getLayoutParams(); params.height = height; view.setLayoutParams(params); } }