当我创建项目时,我选择了Google活动,如何在布局中添加按钮?抱歉,如果这是个愚蠢的问题,我是刚加入Android的。
<Button
android:id="@+id/btn_draw_State"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="right|top"
android:layout_marginTop="55dp"
android:layout_marginRight="11dp" />布局:
<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=".MapsActivityWifi"
android:name="com.google.android.gms.maps.SupportMapFragment">发布于 2015-03-15 21:58:13
来自StackOverFlow PT
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/map"
tools:context=".MapsActivityWifi"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
<Button
android:id="@+id/btn_draw_State"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="right|top"
android:layout_marginTop="55dp"
android:layout_marginRight="11dp" />
</FrameLayout>发布于 2015-03-15 21:33:16
FrameLayout旨在屏蔽屏幕上的一个区域,以显示单个item.Use、LinearLayout或RelativeLayout。
试一试,并根据自己的意愿更改按钮属性。
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<fragment
android:layout_width="match_parent"
android:layout_height="instead of match parent try to give a value so that it does not occupy the whole screen"
android:id="@+id/map"
tools:context=".MapsActivityWifi"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
<Button
android:id="@+id/btn_draw_State"
android:layout_below="@id/map"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="right|top"
android:layout_marginTop="55dp"
android:layout_marginRight="11dp" />
https://stackoverflow.com/questions/29066289
复制相似问题