contentView的点击事件
Closed this issue · 4 comments
Christine-YNG commented
- 系统版本:9.0
- 库版本:2.2.0
- 问题描述/重现步骤:contentView的点击事件,需要点击两次才能触发
razerdp commented
无法重现
Christine-YNG commented
你可以试一下下面的代码。
还有#235的问题,将你的demo下载下来,module引用改为library引用,会直接报错的
public class TestPopup extends BasePopupWindow {
public TestPopup(Context context) {
super(context);
setOutSideDismiss(false);
getContentView().setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View v) {
dismiss();
}
});
}
@OverRide
public View onCreateContentView() {
return createPopupById(R.layout.pop_test);
}
}<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#50000000"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_centerInParent="true"
android:layout_margin="25dp"
android:background="#ffffff"
android:gravity="center"
android:text="content"
android:textColor="#000000" />
</RelativeLayout>
…------------------ 原始邮件 ------------------
发件人: "WeiChaoFeng"<notifications@github.com>;
发送时间: 2019年11月15日(星期五) 上午9:47
收件人: "razerdp/BasePopup"<BasePopup@noreply.github.com>;
抄送: "眸蔓月妮"<413768757@qq.com>;"Author"<author@noreply.github.com>;
主题: Re: [razerdp/BasePopup] contentView的点击事件 (#238)
无法重现
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
razerdp commented
235我已经留意到了,所以235在下个版本会修复
razerdp commented
该问题的原因在于PopupDecorView抢占了焦点,使得ContentView在第一次按下的时候是获取焦点,第二次才是响应事件,在2.2.2中修复了这个问题。