使用Framelayout作为片段容器的Android AppBar
我面临着一个我无法解决的问题。如果有人能给我一个快速的解决方案,这将使我的一天。 正如您在所附图片中看到的,FrameLayout不在AppBar下方。我使用FrameLayout作为片段的容器。所以我想要实现的是框架布局就在AppBar的正下方。我想我可以做到这一点,但我认为这不是正确的解决办法。 致以最良好的问候,并提前表示感谢使用Framelayout作为片段容器的Android AppBar,android,android-appbarlayout,android-framelayout,Android,Android Appbarlayout,Android Framelayout,我面临着一个我无法解决的问题。如果有人能给我一个快速的解决方案,这将使我的一天。 正如您在所附图片中看到的,FrameLayout不在AppBar下方。我使用FrameLayout作为片段的容器。所以我想要实现的是框架布局就在AppBar的正下方。我想我可以做到这一点,但我认为这不是正确的解决办法。 致以最良好的问候,并提前表示感谢 尝试改用相对值 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/andr
尝试改用
相对值
<RelativeLayout 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="true"
tools:context="com.mbcs.MainActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbarId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_below="appbarId"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
</RelativeLayout>
不要使用协调布局
,使用相对布局
,然后您可以使用下面的布局或上面的布局的标签