[英]Android Here-API :How to add buttons to a Here maps infobubble
是否可以在此處地圖信息氣泡中添加按鈕。 我在這里檢查了Android maps api,但沒有發現任何有用的東西。 只是想知道以前是否有人嘗試過?
謝謝
您應該使用InfoBubbleAdapter設置氣泡布局:
Map hMap.setInfoBubbleAdapter(new Map.InfoBubbleAdapter() {
@Override
public View getInfoBubbleContents(MapMarker mapMarker) {
return null;
}
@Override
public View getInfoBubble(final MapMarker mapMarker) {
View bubble;
bubble = LayoutInflater.from(getActivity()).inflate(R.layout.tooltip_cluster, container, false);
Button btn = (Button) bubble.findViewById(R.id.btnBubble);
return bubble;
}
});
並在布局中定義按鈕
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="#00f">
<EditText
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center"
android:hint="Hello World !"
android:textColor="@android:color/white"
android:background="#c0392b"/>
<Button
android:layout_below="@+id/btnBubble"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="click ME !"/>
</RelativeLayout>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.