如何在Seam上定位Android浮动操作按钮
我有一张地图,下面有一个区域代表一张底片 我想在这两者之间的接缝上,右手边放置一个浮动操作按钮 有人能就我如何实现这一目标提出建议吗 XML如下,感谢阅读如何在Seam上定位Android浮动操作按钮,android,layout,floating-action-button,Android,Layout,Floating Action Button,我有一张地图,下面有一个区域代表一张底片 我想在这两者之间的接缝上,右手边放置一个浮动操作按钮 有人能就我如何实现这一目标提出建议吗 XML如下,感谢阅读 <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/too
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- Map -->
<com.google.android.gms.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:longClickable="true"
app:cameraZoom="15"
app:mapType="normal"
android:layout_above="@+id/botsheet_frame"/>
<!-- FAB -->
<android.support.design.widget.FloatingActionButton
android:id="@+id/myFAB"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
app:layout_anchor="@id/botsheet_frame"
app:layout_anchorGravity="bottom|right|end"
android:src="@android:drawable/ic_dialog_email"
android:layout_margin="16dp"
android:clickable="true"/>
<!-- place holder for basic BottomSheet area-->
<RelativeLayout
android:id="@id/botsheet_frame"
android:background="#ffffff"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_alignParentBottom="true"
android:padding="6dp">
<!-- TextView to be added here -->
</RelativeLayout>
</RelativeLayout>
</FrameLayout>
尝试使用RelativeLayout而不是LinearLayout。对于FloatingActionButton,添加如下属性
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="end|bottom"
请参考,它将帮助你。非常感谢阿普瓦,这一点很好。永远欢迎…投票!!