是否可以在“google 地图 activity”中添加一个按钮以将控制权传递给另一个 activity?
Is it possible to add a button in " google maps activity" to pass control to another activity?
我是 android 的新手,我想添加 Google 地图来显示用户当前位置,我已经用 Google 地图 activity 完成了。现在我需要的是,我必须启用一个选项来输入目的地,所以我想在该地图中添加一个按钮 layout.Is 可能吗?如果可能的话,我如何添加 this.I 选择此布局。
<fragment 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" android:id="@+id/map" tools:context=".MapsActivity"
android:name="com.google.android.gms.maps.SupportMapFragment"
tools:layout="@layout/abc_list_menu_item_radio" />
是的,采用一种相对布局并将片段和您的按钮放在相对布局中。
试试这个代码可能会对你有所帮助..
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="500dp"
tools:context=".MapsActivity"
tools:layout="@layout/abc_list_menu_item_radio" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
我是 android 的新手,我想添加 Google 地图来显示用户当前位置,我已经用 Google 地图 activity 完成了。现在我需要的是,我必须启用一个选项来输入目的地,所以我想在该地图中添加一个按钮 layout.Is 可能吗?如果可能的话,我如何添加 this.I 选择此布局。
<fragment 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" android:id="@+id/map" tools:context=".MapsActivity"
android:name="com.google.android.gms.maps.SupportMapFragment"
tools:layout="@layout/abc_list_menu_item_radio" />
是的,采用一种相对布局并将片段和您的按钮放在相对布局中。 试试这个代码可能会对你有所帮助..
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="500dp"
tools:context=".MapsActivity"
tools:layout="@layout/abc_list_menu_item_radio" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>