2017-02-27 44 views
0

の間のギャップを埋める方法について説明します。レイアウト - 私は私のアプリと下部のBottomNavigationView(別名タブコントローラ)の上部にあるツールバーを持って上部バーと下部バー

それはそれらの間のギャップを埋めるように、私はセットアップにフレームレイアウトを必要としています。これにより、選択したタブのコンテンツが保持されます。

これは簡単に聞こえる、と私はここに問題を抱えている少し驚いています。

(背景黄色ので、私はそれを見ることができます)私はlayout_aboveとlayout_belowを使用しようとしましたが、それは、フレームをレンダリングするために失敗しました。それが私には分かりません。

任意のアイデアください

<RelativeLayout 
    android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

    <android.support.v7.widget.Toolbar 
       xmlns:android="http://schemas.android.com/apk/res/android" 
       xmlns:app="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:minHeight="?attr/actionBarSize" 
       android:background="#007AFF" 
       app:layout_scrollFlags="scroll|enterAlways" 
       android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
       app:popupTheme="@style/ThemeOverlay.AppCompat.Dark" /> 

    <FrameLayout 
      android:id="@+id/frame_fragmentholder" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="@color/yellow" 
      android:layout_below="@id/toolbar" 
      android:layout_above="@id/bottom_nav"/> 

    <android.support.design.widget.BottomNavigationView 
      android:id="@+id/bottom_nav" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      app:itemIconTint="@drawable/selector" 
      app:itemTextColor="@drawable/selector" 
      android:background="#007AFF" 
      app:menu="@menu/bottombar_menu" /> 
</RelativeLayout> 

答えて

0

これに対する答えは下のナビゲーションバーの下端に、フレームの下端を設定することのようですが、その後もNAVの高さを可能にbarにmargin_bottom属性を追加します。これは、枠の下端を下端棒の上端にする効果があります。

android:layout_alignBottom="@+id/bottom_nav" 
    android:layout_marginBottom="?attr/actionBarSize" 



    <FrameLayout 
      android:id="@+id/frame_fragmentholder" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@color/yellow" 
      android:layout_below="@id/toolbar" 
      layout_alignBottom="@+id/bottom_nav" 
      android:layout_marginBottom="?attr/actionBarSize" /> 
関連する問題