set View Dimensions - Android User Interface

Android examples for User Interface:View Property

Description

set View Dimensions

Demo Code

/* ViewUtil.java//from w w w .  ja v  a  2s. c om
 * See the file "LICENSE.md" for the full license governing this code.
 */
//package com.java2s;

import android.view.View;
import android.view.ViewGroup;

public class Main {
    public static void setDimensions(View view, int width, int height) {
        ViewGroup.LayoutParams params = view.getLayoutParams();
        params.width = width;
        params.height = height;
    }
}

Related Tutorials