android 地图视图问题
我想在地图视图图钉上显示一个简单的文本视图。单击该图钉时我想显示详细信息。
当用户点击特定点时我想显示该点的名称..这些名称我存储在 POJO 类中并且我想从中检索,现在在我的代码中我成功获取了名称,但唯一的问题是名称不是显示在该微粒水龙头点上。
请帮助...
这是我的代码...
@Override
public boolean onTap(GeoPoint p, MapView mapView) {
str.
final PopupWindow popupWindow;
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.popup, (ViewGroup) findViewById(R.id.rootId));
TextView text = (TextView)layout.findViewById(R.id.nameTextView);
text.setText("Lake Name");
text.setBackgroundColor(Color.BLACK);
popupWindow=new PopupWindow(layout);
popupWindow.setTouchable(true);
popupWindow.setWidth(LayoutParams.WRAP_CONTENT);
popupWindow.setHeight(LayoutParams.WRAP_CONTENT);
popupWindow.showAtLocation(layout,Gravity.CENTER_HORIZONTAL,10,0);
builder=new AlertDialog.Builder(DummyLocationActivity.this);
text.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
popupWindow.dismiss();
LayoutInflater inflater=LayoutInflater.from(DummyLocationActivity.this);
View desc= inflater.inflate(R.layout.description,(ViewGroup) findViewById(R.id.root));
builder.setView(desc);
builder.show();
}
});
return true;
}
I want to show a simple text view on map view pushpin.on click of that pushpin i want to show the detail info.
when user taps on specific point i want to show name of that point..these name I'm storing in POJO class and i want to retrieve from that,now in my code I'm successfully getting names but only problem is names are not displaying on that particulate tap point.
Please Help...
here is my code....
@Override
public boolean onTap(GeoPoint p, MapView mapView) {
str.
final PopupWindow popupWindow;
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.popup, (ViewGroup) findViewById(R.id.rootId));
TextView text = (TextView)layout.findViewById(R.id.nameTextView);
text.setText("Lake Name");
text.setBackgroundColor(Color.BLACK);
popupWindow=new PopupWindow(layout);
popupWindow.setTouchable(true);
popupWindow.setWidth(LayoutParams.WRAP_CONTENT);
popupWindow.setHeight(LayoutParams.WRAP_CONTENT);
popupWindow.showAtLocation(layout,Gravity.CENTER_HORIZONTAL,10,0);
builder=new AlertDialog.Builder(DummyLocationActivity.this);
text.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
popupWindow.dismiss();
LayoutInflater inflater=LayoutInflater.from(DummyLocationActivity.this);
View desc= inflater.inflate(R.layout.description,(ViewGroup) findViewById(R.id.root));
builder.setView(desc);
builder.show();
}
});
return true;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
OnTap(intposition) 您可以使用position获得点击时的特定项目。
OnTap(int position) you can get the particular item on tap by using the position .