在Android中添加按钮到Google Map [英] Adding buttons to Google Map in android
本文介绍了在Android中添加按钮到Google Map的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在map fragment API v2布局顶部添加按钮。但没有得到期望的结果。
有人可以帮助我正确的布局。欣赏你的帮助。
解决方案
尝试这样:
< RelativeLayout xmlns:android =http://schemas.android.com/apk/res/android
xmlns:tools =http://schemas.android.com/tools
android:layout_width =match_parent
android:layout_height =match_parent
tools:context =。MainActivity>
< fragment
android:id =@ + id / map
android:layout_width =match_parent
android:layout_height =match_parent
class =com.google.android.gms.maps.MapFragment/>
< Button
android:id =@ + id / setRangeButton
android:layout_width =wrap_content
android:layout_height =wrap_content
android:text =@ string / setRange/>
< / RelativeLayout>
I am new to android. I am doing a project as part of my academic. I would like to have few buttons in bottom of the Google Map android like in the waze android application(Sorry that not able to post screen shot). I have tried few things based on the below link How to add buttons at top of map fragment API v2 layout . But did not get desired results.
Can someone please help me with the proper layout. Appreciate your help.
解决方案
Try this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment" />
<Button
android:id="@+id/setRangeButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/setRange" />
</RelativeLayout>
这篇关于在Android中添加按钮到Google Map的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文