set Height For View - Android User Interface

Android examples for User Interface:View Size

Description

set Height For View

Demo Code


//package com.java2s;

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

public class Main {
    public static void setHeightForView(View view, int heightInPixels) {
        ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        layoutParams.height = heightInPixels;
        view.setLayoutParams(layoutParams);
    }/*from  w ww  .  j a va2  s. com*/
}

Related Tutorials