Comments (13)
@ygeng
使用的是最新版本吗?
from xpopup.
@ygeng
使用的是最新版本吗?
是的
from xpopup.
@ygeng
贴下代码,我这里无法复现。
from xpopup.
class BottomDialog (var activity: Activity) : BottomPopupView(activity) {
private val TAG = BottomDialog::class.java.simpleName
private lateinit var tvText1: TextView
private lateinit var tvText2: TextView
private lateinit var tvCancel: TextView
private var text1: String = ""
private var text2: String = ""
private var cancel: String = "取消"
private var onItemClickListener: OnItemClickListener ?= null
override fun getImplLayoutId(): Int {
return R.layout.layout_bottom_dialog
}
override fun initPopupContent() {
super.initPopupContent()
tvText1 = findViewById<TextView>(R.id.tv_text1)
tvText2 = findViewById<TextView>(R.id.tv_text2)
if (!text1.isEmpty()) {
tvText1.text = text1
}
tvText1.setOnClickListener {
if (onItemClickListener != null) {
onItemClickListener?.onItemClick(0)
} else {
Log.e(TAG, "Please set OnUserSelectListener!!!")
}
}
if (!text2.isEmpty()) {
tvText2.text = text2
}
tvText2.setOnClickListener {
if (onItemClickListener != null) {
onItemClickListener?.onItemClick(1)
} else {
Log.e(TAG, "Please set onItemClickListener!!!")
}
}
tvCancel = findViewById<TextView>(R.id.tv_cancel)
tvCancel.text = cancel
tvCancel.setOnClickListener {
if (onItemClickListener != null) {
onItemClickListener?.onItemClick(2)
} else {
Log.e(TAG, "Please set onItemClickListener!!!")
}
}
}
fun setText(text1: String, text2: String, cancel: String): BottomDialog {
this.text1 = text1
this.text2 = text2
this.cancel = cancel
return this
}
fun setOnItemClickListener(onItemClickListener: OnItemClickListener): BottomDialog {
this.onItemClickListener = onItemClickListener
return this
}
interface OnItemClickListener {
fun onItemClick(position: Int)
}
}
from xpopup.
可以在外部使用手势向下滑动关闭对话框,但是点击外部没有反应
from xpopup.
@ygeng
显示弹窗那部分代码贴下。
from xpopup.
if (selectImageDialog == null) {
selectImageDialog = BottomDialog(this).setText(getString(R.string.take_picture), getString(R.string.select_from_album), getString(R.string.cancel))
.setOnItemClickListener(object : BottomDialog.OnItemClickListener {
override fun onItemClick(position: Int) {
when (position) {
0 -> {
openCamera()
XPopup.get(mContext).dismiss()
}
1 -> {
openAlbum()
XPopup.get(mContext).dismiss()
}
2 -> {
XPopup.get(mContext).dismiss()
}
}
}
})
}
XPopup.get(this).asCustom(selectImageDialog).dismissOnTouchOutside(true).autoDismiss(true).show()
from xpopup.
@ygeng
代码看起来并没有特殊的地方,可以加我QQ:16167479。把出问题的demo发我一份,我帮你看看。
from xpopup.
大佬,知道问题了,我的布局设置的match_parent导致的,改成wrap_content就可以了
from xpopup.
@ygeng
怪我没特意说明,现在加了说明:
from xpopup.
好的,感谢大佬🙏
from xpopup.
自定义bottom弹窗,启用手势,布局高度是match_parent的,指定maxheight,但是hasShadowBg(true)方法失效(弹窗以外没有半透明背景)
三星Galaxy A9
Android 8.0
from xpopup.
如果布局改为wrap_content,hasShadowBg(true)有效果,但是第一次弹出来的高度很小,并且向下滑动到看不见后,界面无法点击(弹窗应该没有dismiss)在屏幕上向上滑动还可以滑出来
from xpopup.
Related Issues (20)
- XPopup 中设置了 isTouchThrough(true) ,触摸平移一个 imageview ,当 popview dismiss 以后,当前自定义的 view类中的 dispatchTouchEvent都不执行了
- dismiss方法会走多次 HOT 1
- 夜间与日间模式(暗黑模式)设置无效setDefaultNightMode
- 能否增加在service弹出
- 自定义DrawerPopupView时,设置topMargin后 显示范围虽然变了 但阴影还在
- vivoX60系统为Android13手势返回没屏蔽掉 HOT 2
- 使用查看大图功能时,部分手机存储权限已开启,点击保存图片无效
- 使用viewbinding报错 HOT 1
- Support more type?
- 手势不能透传到下方界面
- 2.10.0版本存在主动调用show()不能弹出的问题 HOT 2
- BubbleAttachPopupView 的atview 高度过长时弹框展示异常
- java.lang.NullPointerException: Attempt to read from field 'com.lxj.xpopup.enums.PopupPosition com.lxj.xpopup.core.PopupInfo.popupPosition' on a null object reference
- BubbleAttachPopupView 在rtl布局情况下,左中右三个目标view绑定后,右边的view弹窗位置正确但是箭头的位置并未在目标位置下方,偏移位置异常 HOT 1
- 如何适配 EdgeToEdge HOT 1
- 使用hasBlurBg,关闭打开弹窗多次,模糊效越不明显,最后弹框以外变黑了
- CenterPopupView弹窗宽度无法占满屏幕
- 你好,兄弟。是否考虑支持jetpack compose的计划
- 弹窗显示超出屏幕
- 关于气泡的问题
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xpopup.