Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.app.Activity;

import android.util.Log;

import android.view.ViewGroup;

import android.widget.RelativeLayout;

public class Main {
    /**
     *
     * @param act
     * @return
     */
    public static RelativeLayout getContainerView(Activity act) {
        // create a new relative layout
        RelativeLayout rl = new RelativeLayout(act);

        // fint the root view of the activity
        ViewGroup fl = (ViewGroup) act.findViewById(android.R.id.content);
        fl = (ViewGroup) fl.getChildAt(0);
        Log.d("DEBUG", "w: " + fl.getWidth() + "h: " + fl.getHeight());

        // Params
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(-1, -1);
        //        new FrameLayout.LayoutParams(-1, -1);
        // add to the root view of the activity
        fl.addView(rl, params);

        return rl;
    }
}