package com.ydl.utils; import android.content.Context; import android.graphics.drawable.BitmapDrawable; import android.view.Gravity; import android.view.View; import android.view.WindowManager; import android.widget.PopupWindow; import com.ydl.view.MoreClickView; import com.ydl.webview.IJavascriptHandler; /** * Created by Wi1ls on 2016/10/17; */ public class PopUtils { public static PopupWindow showMoreItem(Context context, View view, IJavascriptHandler jtoJHandle){ MoreClickView v= new MoreClickView(context,jtoJHandle); WindowManager windowManager= (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); final PopupWindow popupWindow=new PopupWindow(v, windowManager.getDefaultDisplay().getWidth(), windowManager.getDefaultDisplay().getHeight()); v.setPopupWindow(popupWindow); popupWindow.setFocusable(false); popupWindow.setOutsideTouchable(true); popupWindow.setBackgroundDrawable(new BitmapDrawable()); popupWindow.showAtLocation(view, Gravity.CENTER,0,0); return popupWindow; } }