我正在使用 pop-window 在单击 edit-text 时显示一些文本视图。但是弹出窗口没有显示在特定位置,它总是显示在左上角,这是我的代码,有什么问题
private void showPopup(Context context,final LinearLayout Parent) {
LayoutInflater layoutInflater = (LayoutInflater)context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
layout = layoutInflater.inflate(R.layout.popup,MainActivity.parent,true);
// Creating the PopupWindow
final PopupWindow popupWindow = new PopupWindow(
layout,700,700);
popupWindow.setContentView(layout);
popupWindow.setHeight(500);
new Runnable(){
@Override
public void run() {
popupWindow.showAtLocation(layout, Gravity.CENTER,300,150);
}
};
}