Android 如何在所有活动中显示晶圆厂
在我的Android 如何在所有活动中显示晶圆厂,android,xml,floating-action-button,Android,Xml,Floating Action Button,在我的activity\u navigation.xml中,我将我的FAB放在这里。 详情如下: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"
activity\u navigation.xml
中,我将我的FAB
放在这里。
详情如下:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/content_frame">
<com.github.clans.fab.FloatingActionMenu
android:id="@+id/menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:menu_icon="@drawable/quick_apply"
android:layout_gravity="bottom|right"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp">
<com.github.clans.fab.FloatingActionButton
android:id="@+id/view_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/imgicon"
fab:fab_size="mini"
fab:fab_label="View Images" />
<com.github.clans.fab.FloatingActionButton
android:id="@+id/camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/camicon"
fab:fab_size="mini"
fab:fab_label="Camera" />
</com.github.clans.fab.FloatingActionMenu>
</FrameLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigationView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:menu="@menu/activity_navigation_drawer"
android:background="@color/tableHeader"/>
//我没有您的资源值,所以我尝试制作一个测试示例,用textview替换您的抽屉视图。如果我将framelayout height与match parent放在一起,我只会看到一个文本视图,如果我将height设置为20dp,它将同时显示两个文本视图
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="20dp"
android:id="@+id/content_frame">
<TextView
android:text="text above"
android:textSize="20sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</FrameLayout>
<TextView
android:text="text below"
android:textSize="20sp"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
</LinearLayout>
我所做的是在我的
activity\u navigation.xml中创建两个FrameLayout
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<com.github.clans.fab.FloatingActionMenu
android:id="@+id/menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:menu_icon="@drawable/quick_apply"
android:layout_gravity="bottom|right"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp">
<com.github.clans.fab.FloatingActionButton
android:id="@+id/view_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/imgicon"
fab:fab_size="mini"
fab:fab_label="View Images" />
<com.github.clans.fab.FloatingActionButton
android:id="@+id/camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/camicon"
fab:fab_size="mini"
fab:fab_label="Camera" />
</com.github.clans.fab.FloatingActionMenu>
</FrameLayout>
我的FAB
不在content\u框架内,因此它不会重叠。使用活动片段瞬间您的导航视图具有匹配父项的高度。您的框架布局也与父级高度匹配,它们将重叠,您可以尝试将框架布局设置为20dp高度和see@kggoh它仍然不显示:(我试图在framelayout中为layout_height设置20dp。@kggoh我试图在fab现在显示的其他活动xml中设置20dp height。有没有办法解决这个问题?因为我需要在屏幕上整体显示这些活动的内容。请检查下面的测试示例,尝试使用另一个xml文件,使用更简单的vi进行测试ew component,查看是否可以同时看到这两个组件,如果未正确设置宽度和高度,则使用framelayout会使组件重叠,但不会在整个屏幕中显示布局:(你的意思是什么。它会的。线性布局与父级高度匹配。也许你必须发布一个屏幕,说明你试图在这里实现的目标应该是注释,而不是答案。当你写答案时,请编写相关的代码段。)
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<com.github.clans.fab.FloatingActionMenu
android:id="@+id/menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:menu_icon="@drawable/quick_apply"
android:layout_gravity="bottom|right"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp">
<com.github.clans.fab.FloatingActionButton
android:id="@+id/view_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/imgicon"
fab:fab_size="mini"
fab:fab_label="View Images" />
<com.github.clans.fab.FloatingActionButton
android:id="@+id/camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/camicon"
fab:fab_size="mini"
fab:fab_label="Camera" />
</com.github.clans.fab.FloatingActionMenu>
</FrameLayout>