这里的Andr​​oid的API:如何按钮添加到这里映射infobubble [英] Android Here-API :How to add buttons to a Here maps infobubble

查看:200
本文介绍了这里的Andr​​oid的API:如何按钮添加到这里映射infobubble的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能一个按钮添加到这里映射信息泡。我检查Android这儿地图API,但没有发现任何有用的东西。如果任何一个已经在此之前试过只是想知道?

Is it possible to add a button to a Here maps info-bubble. I checked Android here maps api but did not find any thing useful. Just wondering if any one has tried this before?

感谢

推荐答案

您应该使用InfoBubbleAdapter设置泡沫布局:

you should use InfoBubbleAdapter to set bubble layout :

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>

这篇关于这里的Andr​​oid的API:如何按钮添加到这里映射infobubble的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆