[英]Popup Window InputEventReceiver Error - Android
我不喜欢错误。 我正在使用弹出窗口在TextView上方显示一些提示。 提示是什么TextView的是说,例如打点的解释,会弹出一个提示说我不断收到此错误“击球后跑” W/InputEventReceiver﹕ Attempted to finish an input event but the input event receiver has already been disposed.
每次我在弹出窗口提示之外单击以删除弹出窗口时(这是我想要设置的方式),就会收到该错误。 我尝试将输入设置为INPUT_METHOD_NOT_NEEDED
,什么也没有
我有多个提示要显示,所以我将所有内容都放在一个TextView数组中,并且每个TextView项都有一个侦听器
运行弹出窗口的方法
public void displayPopupWindow(View anchorView, String text) {
final PopupWindow popup = new PopupWindow(getApplicationContext());
View layout = getLayoutInflater().inflate(R.layout.test_popup, null);
((TextView) layout.findViewById(R.id.popup_text)).setText(text);
popup.setContentView(layout);
// Set content width and height
popup.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
popup.setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
// Closes the popup window when touch outside of it - when looses focus
popup.setOutsideTouchable(true);
popup.setTouchable(false);
popup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
// Show anchored to button
popup.setBackgroundDrawable(new BitmapDrawable());
popup.showAsDropDown(anchorView, 0, -225);
}
我创建一个监听器
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View v) {
String text = "";
...
//a bunch of code that just decides what the variable text should be
...
displayPopupWindow(v, text);
}
};
并将TextViews侦听器的数组设置为侦听器对象
//inside a for loop
TextViews[i].setOnClickListener(listener);
任何人都知道摆脱该错误。 我不想让logcat充满那些错误。 任何人有任何想法如何解决此问题?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.