我是Android的新手。我正在做一个关于Multicasting的项目。现在我需要在标记上点击时在地图中显示一个气泡。 我不需要对话框,需要一个带有按钮和textview的气泡视图。想先显示textview。不知道我用这个代码做了什么。已经这么多次了。但是没有任何想法。这个是我的onTap代码:
protected boolean onTap(int index)
{
System.out.println("Tapped");
//To display the bubble for robots:
//LayoutInflater inflater = this.getLayoutInflater();
//bubble_view = (LinearLayout) inflater.inflate(R.layout.window_view, bubble_view );
TextView venueName = (TextView) bubble_view.findViewById(R.id.name1);
venueName.setText("Hello SK");
GeoPoint rPoint = null;
MapView.LayoutParams params = new MapView.LayoutParams(
LayoutParams.WRAP_CONTENT, 200,
rPoint, MapView.LayoutParams.BOTTOM_CENTER);
bubble_view.setLayoutParams(params);
System.out.println("sgdhgsetlumstmwejfsd");
map.addView(bubble_view);
Runnable r = new Runnable() {
public void run() {
bubble_view.setVisibility(View.VISIBLE);
}
};
//Projection projection = ((MapView) map).getProjection();
//Point p = new Point();
//projection.toPixels(rPoint, p);
//p.offset(0, -(bubble_view.getMeasuredHeight() / 2));
//GeoPoint target = projection.fromPixels(p.x, p.y);
//mapController = ((MapView) map).getController();
//mapController.setZoom(16);
//mapController.animateTo(target, r);
//Toast.makeText( mContext,"Device Name: "+index,Toast.LENGTH_SHORT).show();
//return bubble_view != null;
return true;
}
private LayoutInflater getLayoutInflater() {
// TODO Auto-generated method stub
return null;
}
}
这是我的代码。它有错误。我的LayoutInflator仅定义在我所引用的代码的onCreate.Most部分:http://www.actionshrimp.com/tag/android-2/
请帮我纠正。