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)
- BottomPopupView 显示之后会上移 HOT 3
- 页面里面返回键会触发显示是否操作的弹窗,发现有一定的几率弹窗显示后会自动关闭 HOT 2
- bug反馈
- ViewMode模式下同时弹出两个dialog,只有第二个dialog的点击事件能响应
- 反馈BottomListPopupView bug
- Fatal Exception: android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@cc7dead is not valid; is your activity running?
- Android13 保存图片失败 HOT 2
- 支持 kotlin么 HOT 1
- 希望增加支持 jetpack compose HOT 1
- 关于Xpopup设置isViewMode(true)返回事件穿透的问题 HOT 1
- AttachPopupView高度未自适应
- 已解决
- 使用BottomPopupView时,底部有虚拟导航栏的手机会盖住弹框,使用2.9.11版本没问题 HOT 4
- IllegalArgumentException: atView() or watchView() must be called for AttachPopupView before show()! HOT 1
- BubbleAttachPopupView箭头偏移无法设置
- 自定义asBottomList分割线异常
- asLoading.show()方法时,抛出异常,程序崩溃
- 点击透传不到自己定义的dialogfragment
- 底部asbottomlist弹窗的黑色背景会偶尔消失,设置了.hasShadowBg(true),在两个不同的activity,其中一个出现后,另一个也会出现 HOT 1
- BottomPopupView中弹出showNumericEditPopup,完成输入后。输入键盘会再次弹出
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.