get Parent PopupWindow - Android User Interface

Android examples for User Interface:Window

Description

get Parent PopupWindow

Demo Code


//package com.java2s;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ViewGroup.LayoutParams;

import android.widget.PopupWindow;

public class Main {
    public static PopupWindow getMatcParentPopupWindow(View view,
            Drawable backgroundDrawable, Context context) {
        PopupWindow popupWindow = new PopupWindow(context);
        popupWindow.setContentView(view);
        popupWindow.setBackgroundDrawable(backgroundDrawable);
        popupWindow.setWidth(LayoutParams.MATCH_PARENT);
        popupWindow.setHeight(LayoutParams.MATCH_PARENT);
        popupWindow.setOutsideTouchable(true);
        popupWindow.setFocusable(true);//w  ww  . ja  v a  2  s  . c om
        popupWindow.update();
        return popupWindow;
    }
}

Related Tutorials