gpt4 book ai didi

android - 点击标记时如何显示气泡

转载 作者:行者123 更新时间:2023-11-30 04:17:13 28 4
gpt4 key购买 nike

我是 Android 的新手。我正在做一个关于多播的项目。现在我需要一个气泡在点击标记时显示在 map 中。我不需要对话框,需要一个带有按钮和 TextView 的气泡 View 。想先显示 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 中定义。我在本网站引用的大部分代码:http://www.actionshrimp.com/tag/android-2/

请帮我改正。

最佳答案

您可以使用 mapviewballoons库来做到这一点。

关于android - 点击标记时如何显示气泡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9803617/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com