4
我是android开发的noob,我想弄清楚如何在视图中的特定坐标处显示NewQuickAction3D弹出对话框。我正在整合与this教程弹出。实质上,我想使用弹出对话框来显示用户触摸的数据,而不是使用“infoview”在画布上绘画。目前,弹出窗口显示在我将其锚定到的视图顶部&的中心。我怎样才能让它显示一个特定的坐标?任何帮助是极大的赞赏。如何将自定义对话框定位在特定的坐标上?
我的代码
public void updateMsg(String t_info, float t_x, float t_y, int t_c){
infoView.updateInfo(t_info, t_x, t_y, t_c); //Infoview paints to on a specific coordinate
quickAction.show(infoView); //How do I use the t_x & t_y coordinates here instead of just anchoring infoview
编辑
public void updateMsg(String t_info, float t_x, float t_y, int t_c){
infoView.updateInfo(t_info, t_x, t_y, t_c);
WindowManager.LayoutParams wmlp = quickAction.getWindow().getAttributes(); //Error here getting window attributes
wmlp.gravity = Gravity.TOP | Gravity.LEFT;
wmlp.x = 100; //x position
wmlp.y = 100; //y position
quickAction.show(infoView);
}
感谢您的回复。我的答案有些麻烦。 NewQuickAction是一个自定义对话框,所以它不会让我获得窗口属性。有什么想法吗? – 2013-05-07 12:49:27
使您的自定义视图活动类的内部类 – Raghunandan 2013-05-07 12:51:52