如何在图像上放置多个可点击的点?

时间:2017-01-15 01:56:49

标签: android image google-maps coordinates google-maps-android-api-2

我的照片中有我所在国家的主要地铁地图。我需要用户可以按地图图像上的电台。

我的问题是,如何在图片上放置多个可点击点?这些点将是地铁站。

我发现每隔几个小时,但我没有看到任何特定的内容。

我搜索了很多个小时,我找到了这些帖子:

1.-这question可能解决了我的问题,但是已经很老了,这让我觉得有一些更新的功能。

2.-在此question中说您可以使用" GoogleMap对象和地面覆盖" 但我找到了关于Ground Overlay主题的官方文档并且带有地图的图像并不是唯一的,图像有背景谷歌地图。

有没有人知道我是否有一个当前的工具可以解决这个问题?

非常感谢你的帮助。

1 个答案:

答案 0 :(得分:0)

您可以在想要使用相对布局选择单击的位置将透明按钮放在图像视图的顶部,然后只需处理按钮点击。

 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" >

 <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@android:drawable/edit_text" />

 <Button android:id="@+id/bottomLeft" android:layout_width="100dip" android:layout_height="100dip" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:background="@android:color/transparent" />

 <Button android:id="@+id/center" android:layout_width="100dip" android:layout_height="100dip" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:background="@android:color/transparent" /> 

<Button android:id="@+id/bottomRight" android:layout_width="100dip" android:layout_height="100dip" android:layout_centerInParent="true" android:background="@android:color/transparent" />

 </RelativeLayout>