add View To Top - Android User Interface

Android examples for User Interface:View Layer

Description

add View To Top

Demo Code


//package com.java2s;

import android.content.Context;

import android.view.View;
import android.view.WindowManager;

public class Main {
    public static final String WINDOW_SERVICE = "window";

    public static WindowManager.LayoutParams addViewToTop(Context context,
            View view, WindowManager.LayoutParams params) {
        WindowManager wm = (WindowManager) context.getApplicationContext()
                .getSystemService(WINDOW_SERVICE);
        try {// w w  w  .  ja v  a  2 s.  com
            wm.removeView(view);
        } catch (Exception e) {
        }
        wm.addView(view, params);
        return params;
    }
}

Related Tutorials