ice45571
1/21/2019 - 7:13 AM

PopWindow

popwindow工具类

fun createPop(context: Context, onViewCreate: (View, PopupWindow) -> Unit = { _, _ -> },
              layoutId: Int = R.layout.pop_settings): PopupWindow {
    val contentView = LayoutInflater.from(context).inflate(layoutId, null)
    val popupWindow = PopupWindow(contentView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
    onViewCreate(contentView, popupWindow)
    popupWindow.isOutsideTouchable = true
    popupWindow.isFocusable = true
    popupWindow.setBackgroundDrawable(BitmapDrawable())
    return popupWindow
}