set View Size - Android User Interface

Android examples for User Interface:View Size

Description

set View Size

Demo Code


//package com.java2s;

import android.view.View;

import android.widget.FrameLayout;

public class Main {
    private static void setViewSize(View view, int size) {
        FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) view
                .getLayoutParams();//w  ww .j a v  a  2 s  . com
        params.width = size;
        params.height = size;
        view.setLayoutParams(params);
        view.requestLayout();
    }
}

Related Tutorials