W / InputEventReceiver:尝试完成输入事件但输入事件接收器已经处理完毕。在预棒棒糖上

时间:2017-07-20 13:43:02

标签: android android-support-library toolbar compatibility android-appcompat

当我尝试按前Lollipop上的工具栏按钮时,它没有响应,我得到了这个日志输出: 07-20 16:31:59.797 25217-25217/io.github.delta.justreadit W/InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed. Android Nougat上的一切都很好。我使用Android支持库v26。

read.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:id="@+id/changeFontFamily"
        android:icon="@drawable/ic_action_fontoptions"
        android:title="@string/view_settings"
        app:showAsAction="ifRoom" />
</menu>

onOptionsItemSelected和onCreateOptionsMenu

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.read, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.changeFontFamily:
            fontOptionsMenuWindow.showAsDropDown(findViewById(R.id.changeFontFamily));
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}

1 个答案:

答案 0 :(得分:0)

问题不存在。问题在于前Lollipop和Lollipop上的视图测量算法不同。我已使用ViewTreeObserver设置PopupWindow的大小,因为我不知道PopupWindow.setHeight支持WRAP_CONTENT。固定的。