Android examples for User Interface:View Size
Change size of view.
//package com.java2s; import android.view.View; import android.view.ViewGroup.LayoutParams; public class Main { /**/*ww w . j av a2 s . co m*/ * Change size of view. * @param view View to change size. * @param width New width. * @param height New height. */ public static void setSize(View view, int width, int height) { if (view == null) return; LayoutParams params = view.getLayoutParams(); params.width = width; params.height = height; view.requestLayout(); } }