在软键盘顶部显示PopUpWindow

时间:2016-06-21 19:10:18

标签: android android-edittext android-softkeyboard popupwindow android-popupwindow

我正在尝试在我的edittext顶部显示我的PopUpWindow(软键盘存在)我该怎么做?考虑我的EditText有android:maxLines="5",Y位置并不总是相同。这就是我到目前为止所得到的......

private void createPopUpWindow() {
    View newView = getActivity().getWindow().getDecorView(); // this = activity

    int[] loc = new int[2];
    pivot.getLocationInWindow(loc);
    int topOfPivot = loc[1];

    Integer positionY = topOfPivot;
    popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    popupWindow.showAtLocation(newView, Gravity.BOTTOM, 0, positionY);

    frameLayout.getForeground().setAlpha(15);
    editText.setSelection(editText.getText().length());
}

有什么建议吗?

Here is a little bit up

What am i doing wrong?

0 个答案:

没有答案