android-使用Popupwindow
程序员文章站
2022-04-12 22:30:13
PopWindwos弹窗private fun showStockPickPopupWindow(context: Context?, currentView: View, data: FStockPickerIndexEntity) { if (mLongPressSelectPopupWindow != null && mLongPressSelectPopupWindow!!.isShowing) { return }....
PopWindwos弹窗
private fun showStockPickPopupWindow(context: Context?, currentView: View, data: FStockPickerIndexEntity) {
if (mLongPressSelectPopupWindow != null && mLongPressSelectPopupWindow!!.isShowing) {
return
}
val rootView = LayoutInflater.from(context).inflate(R.layout.popupwindow_stock_pick, null)
val tv_change_index = rootView.findViewById<TextView>(R.id.tv_change_index)
val tv_change_name = rootView.findViewById<View>(R.id.tv_change_name)
val tv_delete = rootView.findViewById<TextView>(R.id.tv_delete)
tv_change_index.setOnClickListener {
ToastHelper.toastLong("修改指标")
FLaunchHelper.launchToStockPicker(mActivity)
mLongPressSelectPopupWindow!!.dismiss()
}
tv_change_name.setOnClickListener {
ToastHelper.toastLong("重命名")
mLongPressSelectPopupWindow!!.dismiss()
showChangeNameDialog(data)
}
tv_delete.setOnClickListener {
ToastHelper.toastLong("删除")
deleteStock(data)
mLongPressSelectPopupWindow!!.dismiss()
}
mLongPressSelectPopupWindow = PopupWindow(rootView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
mLongPressSelectPopupWindow!!.isOutsideTouchable = true
mLongPressSelectPopupWindow!!.isFocusable = true
mLongPressSelectPopupWindow!!.setBackgroundDrawable(ColorDrawable())
mLongPressSelectPopupWindow!!.isClippingEnabled = false
mLongPressSelectPopupWindow!!.setOnDismissListener { }
mLongPressSelectPopupWindow!!.showAsDropDown(currentView, AutoSizeUtils.pt2px(context, 518f), -(currentView.height - AutoSizeUtils.pt2px(context, 72f)))
val lp = this.window.attributes
lp.alpha = 0.3f
this.window.attributes = lp
mLongPressSelectPopupWindow?.setOnDismissListener(object : PopupWindow.OnDismissListener {
override fun onDismiss() {
lp.alpha = 1.0f
window.attributes = lp
}
})
}
本文地址:https://blog.csdn.net/mlsnatalie/article/details/108128500
推荐阅读
-
HTML5使用ApplicationCache接口实现离线缓存技术解决离线难题
-
css3 transform 3d 使用css3创建动态3d立方体(html5实践)
-
如何使用html5与css3完成google涂鸦动画
-
使用CSS实现弹性视频html5案例实践
-
在IE6系列等老式浏览器中使用HTML5的新标签实现方案
-
html5指南-4.使用Geolocation实现定位功能
-
使用css如何制作时间ICON方法实践
-
HTML5自定义data-* data(obj)属性和jquery的data()方法的使用
-
使用HTML5的链接预取功能(link prefetching)给网站提速
-
使用css3 属性如何丰富图片样式(圆角 阴影 渐变)