1
为什么当我使用CoordinatorLayout
而不是当我使用RelativeLayout
时底部的额外空间在屏幕计算中得到考虑。CoordinatorLayout&RelativeLayout屏幕空间差异
看到其在协调布局在底部添加了蓝色部分。
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
tools:context=".MainActivity.controller.MainActivityNew">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:id="@+id/appbar"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:titleTextColor="@android:color/white"
app:layout_scrollFlags="scroll|enterAlways"
android:background="?attr/colorPrimary"/>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/primary"
android:layout_below="@+id/toolbar"/>
</android.support.design.widget.AppBarLayout>
<FrameLayout
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:id="@+id/frame_container"
android:background="@android:color/white"
android:layout_width="fill_parent"
android:layout_below="@+id/appbar"
android:layout_height="match_parent"
/>
</android.support.design.widget.CoordinatorLayout>
我将片段添加到有FAB的FrameLayout
。在CoordinatorLayout
的情况下,我的FAB按钮在导航菜单按钮下隐藏。
什么可能是可能的解决方案。或为什么这个额外的空间被添加到屏幕布局以及如何避免这个额外的底部空间。
仅使用此是不够的答案做简要说明你已经在你的答案用什么。为什么和你做了什么改变。所以他可以通过你的答案来学习。 –
好吧,对不起:) @jaydroider – MathaN
我需要在我的Fragment FAB。为什么我会把这个放在activity_main中?同样它仍然会离开屏幕,因为你可以看到布局获得的高度不在屏幕上,所以重力参数不会工作 –