Pha*_*inh 7 android sony popupwindow nexus-s
这是我的代码show a PopupWindow
View rootView = activity.getWindow().getDecorView().getRootView();
mPopupWindow.showAtLocation(rootView, Gravity.NO_GRAVITY, 0, 0);
Run Code Online (Sandbox Code Playgroud)
当我测试它时Samsung,Nexus它显示在状态栏下面的设备
但是当我在Sony设备上测试时它显示在状态栏上方(如下图所示)
那么哪个设备显示正确或我做错了什么?任何帮助或建议将非常感谢
我通过在(在下面的代码中)创建一个临时变量 来解决我的问题。
然后当我显示 时,我将在not处显示它Viewtop-lefttopLeftViewPopupWindow(0, the y coordinate of topLeftView)(0,0)
View topLeftView = findViewById(R.id.top_left_View);
int topLeftPos[] = new int[2];
topLeftView.getLocationOnScreen(topLeftPos);
mPopupWindow.showAtLocation(topLeftView, Gravity.NO_GRAVITY, 0, topLeftPos[1]);
Run Code Online (Sandbox Code Playgroud)
我认为这个解决方案适用于所有设备
| 归档时间: |
|
| 查看次数: |
1084 次 |
| 最近记录: |