Change height of view. - Android User Interface

Android examples for User Interface:View Size

Description

Change height of view.

Demo Code


//package com.java2s;
import android.view.View;
import android.view.ViewGroup.LayoutParams;

public class Main {
    /**//from  www. j  av  a 2s  . com
     * Change height of view.
     * @param view View to change height.
     * @param height New height.
     */
    public static void setHeight(View view, int height) {
        if (view == null)
            return;
        LayoutParams params = view.getLayoutParams();
        params.height = height;
        view.requestLayout();
    }
}

Related Tutorials