resize View by Camera.Size - Android User Interface

Android examples for User Interface:View Size

Description

resize View by Camera.Size

Demo Code


//package com.java2s;
import android.hardware.Camera;
import android.view.View;
import android.view.ViewGroup;

public class Main {
    public static void resizeView(View view, Camera.Size size) {
        ViewGroup.LayoutParams params = view.getLayoutParams();
        params.width = size.width;//ww w  . j a  v  a2s. c om
        params.height = size.height;
        view.setLayoutParams(params);
    }
}

Related Tutorials