Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Seam上定位Android浮动操作按钮_Android_Layout_Floating Action Button - Fatal编程技术网

如何在Seam上定位Android浮动操作按钮

如何在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如下,感谢阅读

<?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"

请参考,它将帮助你。非常感谢阿普瓦,这一点很好。永远欢迎…投票!!