我正在尝试在我的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());
}
有什么建议吗?