【发布时间】:2017-05-30 07:25:33
【问题描述】:
我正在尝试在我的主要活动中添加一个自定义标题,该标题已经包含一个底部导航器和一个framelayout,它充当我要显示的fragments 的容器。
下面给出的代码包含一个Linearlayout["@+id/application_header],它应该作为应用程序的标头,但是标头由fragment 显示,container[@+id/main_container] 与标头重叠。
尝试了android:layout_below 和android:layout_above 的属性,但它仍然重叠。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:design="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.amplitude.tron.volksradio.MainActivity">
<LinearLayout
android:id="@+id/application_header"
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:gravity="center_horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RADIO"
android:layout_gravity="center"/>
</LinearLayout>
<FrameLayout
android:id="@+id/main_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/application_header"
android:layout_above="@+id/bottomNavigationBar"
android:layout_alignParentTop="true">
</FrameLayout>
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottomNavigationBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
design:menu="@menu/bottom_menu_navigation"
android:background="#50b1b5b9">
</android.support.design.widget.BottomNavigationView>
</RelativeLayout>
【问题讨论】:
标签: android android-layout android-fragments layout android-framelayout