enter image description here好所以,我制作了fragment_googlemap.xml,并且我将FrameLayout设计为根布局,因为我需要将mapView作为片段。切入正题,我想要发生的事情是在谷歌地图的顶部显示微调和浮动操作按钮。但是当我运行该应用程序时,我看不到相关布局的孩子(微调和浮动按钮)。我认为这是在googlemapview下,因为我可以在加载时在googlemap下看到它们一秒。 任何解决方案?我的Relativelayout将不会显示在FrameLayout下
OOOHH和BTW我不知道为什么抬高属性的值在浮动按钮不起作用任何想法请?
很抱歉,如果我的英语很差:(和THX提前!!!
=======这里是低于===========
我的xml文件的源代码<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fab="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<Spinner
android:id="@+id/spinner_countries"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/fab"
android:layout_below="@+id/fab"
android:entries="@array/location_arraysResc" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_gravity="end|top"
android:layout_margin="10dp"
android:backgroundTint="@color/colorPrimary"
android:elevation="6dp"
android:src="@drawable/paperplane"
android:tint="#000000"
app:borderWidth="0dp"
app:rippleColor="#eF43ef" />
</RelativeLayout>
<com.google.android.gms.maps.MapView
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent">
</com.google.android.gms.maps.MapView>
</FrameLayout>
框架布局必须只有1名儿童。在放入framelayout之前,将您的相对布局和地图放在另一个布局中。 – Lcukerd
在框架布局中,子视图以堆栈形式绘制,最近添加的子项位于顶层。所以在你的情况下,最近添加的孩子是mapview,这就是为什么你的微调和浮动按钮在你的地图背后。颠倒顺序,它会很好。 –
什么是最好的布局?把它们放在一起? – poream3387