Android 在emulator上找不到浮动操作按钮

Android 在emulator上找不到浮动操作按钮,android,android-layout,android-emulator,floating-action-button,Android,Android Layout,Android Emulator,Floating Action Button,我创建了一个带有图像视图、视频视图和浮动操作按钮的布局。我的想法是继续显示VideoView和ImageView上方的浮动操作按钮 下面是我的XML代码,看起来浮动操作按钮隐藏在ImageView和VideoView后面。任何帮助都将不胜感激 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"

我创建了一个带有
图像视图
视频视图
和浮动操作按钮的布局。我的想法是继续显示
VideoView
ImageView
上方的浮动操作按钮

下面是我的XML代码,看起来浮动操作按钮隐藏在
ImageView
VideoView
后面。任何帮助都将不胜感激

<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="fill_parent"
    android:layout_height="fill_parent"
    android:background="#000000"
    android:contentDescription="@string/app_name"
    android:id="@+id/frame"
    tools:context="com.serv24.eframe.FullscreenActivity" >

    <ProgressBar
        android:id="@+id/progressBar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|left"
        android:visibility="visible"
        tools:visibility="visible" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:src="@android:drawable/ic_dialog_email"
        android:visibility="visible"
        app:backgroundTint="@android:color/holo_red_dark"
        app:rippleColor="?android:attr/colorActivatedHighlight" />

    <VideoView
        android:id="@+id/videoView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center_vertical|center_horizontal"
        android:visibility="invisible" />

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center_vertical|center_horizontal"
        android:contentDescription="@string/app_name"
        android:visibility="visible" />
</FrameLayout>

我建议使用
RelativeLayout
而不是
框架布局
,以便在您的案例中更容易实现。您只需将这些元素放在其他元素的下面,就可以在布局中位于上面的元素之上。我正在使用
RelativeLayout
共享您的布局版本。希望有帮助

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/frame"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#000000">

    <ProgressBar
        android:id="@+id/progressBar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentBottom="true" />

    <VideoView
        android:id="@+id/videoView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="invisible" />

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:contentDescription="@string/app_name" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:layout_margin="16dp"
        android:src="@android:drawable/ic_dialog_email"
        android:visibility="visible"
        app:backgroundTint="@android:color/holo_red_dark"
        app:rippleColor="?android:attr/colorActivatedHighlight" />

</RelativeLayout>

在FrameLayout中添加的项目是相互叠加的,因此最新添加的项目位于之前添加的项目之上

在本例中,您首先添加了进度条,然后添加了进度条上方显示的FloatingActionButton,然后添加了FloatingActionButton上方显示的VideoView(如果VideoView是全屏的,它将隐藏您之前放置的所有内容)最后是图像视图,它显示在所有其他内容的顶部

你可以把它想象成把一张张纸叠在一张桌子上

因此,要显示晶圆厂,应该将其放在xml中的最后一个位置(在ImageView之后)