Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.app.Activity;
import android.util.DisplayMetrics;
import android.widget.LinearLayout;

public class Main {
    public static void setLinearLayoutParams(LinearLayout linear, Activity actvity) {
        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                getScreenHeight(actvity) - 200);

        linear.setLayoutParams(lp);
    }

    private static int getScreenHeight(Activity actvity) {
        final DisplayMetrics displayMetrics = new DisplayMetrics();
        actvity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        return displayMetrics.heightPixels;
    }
}