[英]Popup Window InputEventReceiver Error - Android
I dont like errors. 我不喜欢错误。 I'm using a Popup Window to display a little hint above a TextView. 我正在使用弹出窗口在TextView上方显示一些提示。 the hint is for explanation of what the TextView is saying, for example RBI, will popup a hint saying "Runs batted in" I keep getting this error W/InputEventReceiver﹕ Attempted to finish an input event but the input event receiver has already been disposed.
提示是什么TextView的是说,例如打点的解释,会弹出一个提示说我不断收到此错误“击球后跑” W/InputEventReceiver﹕ Attempted to finish an input event but the input event receiver has already been disposed.
everytime i click outside of the popup hint to remove the popup, which is the way i want it to be setup, i get that error. 每次我在弹出窗口提示之外单击以删除弹出窗口时(这是我想要设置的方式),就会收到该错误。 I've tried setting the input to INPUT_METHOD_NOT_NEEDED
and nothing 我尝试将输入设置为INPUT_METHOD_NOT_NEEDED
,什么也没有
i have multiple hints to be shown, so i put everything in an TextView array and i have a listener on each TextView item 我有多个提示要显示,所以我将所有内容都放在一个TextView数组中,并且每个TextView项都有一个侦听器
method to run the popup 运行弹出窗口的方法
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);
}
i create a listener 我创建一个监听器
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);
}
};
and the array of TextViews listeners is set to the listener object 并将TextViews侦听器的数组设置为侦听器对象
//inside a for loop
TextViews[i].setOnClickListener(listener);
anyone know of anyway to rid of that error. 任何人都知道摆脱该错误。 i wouldnt want the logcat to fill up with those errors. 我不想让logcat充满那些错误。 anyone have any ideas how to fix this? 任何人有任何想法如何解决此问题?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.