メインのアクティビティに下位ナビゲータが既に含まれているカスタムヘッダーを追加しようとしています。fragments
のコンテナとして機能します。framelayout
主なアクティビティのコンテンツをオーバーラップさせるフラグメントコンテナのレイアウト
以下のコードには、アプリケーションヘッダーとして機能する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>
を重ね、任意の量が少ない包みもパディングやマージンを追加
、すでにそこにありますコード内の相対的なレイアウトだが、それは残念だが、画面外にナビゲーションメニューをプッシュした2番目のソリューションを試してみた。最後の解決策は私のタイトルがカスタムであるために探しているものではありません – IteratioN7T
'Toolbar'ソリューションでは、依然としてカスタムビューを使用できます。 [references](https://developer.android.com/reference/android/support/v7/widget/Toolbar.html)から: "ツールバーには、次のオプション要素の組み合わせが含まれます:1つ以上のカスタムビュー。子ビューのToolbar.LayoutParamsがGravity値CENTER_HORIZONTALを示している場合、ビューはツールバーに残っている利用可能なスペース内に中央に配置しようと試みます他の要素が測定されています。 –