2016-04-20 27 views
6

新しいマテリアルデザインボトムバーにライブラリを使用していますが、私は非常に奇妙な問題を抱えています。これをコーディネーター・レイアウトに入れると、ツールバーの上に表示されます。なぜこれが起こっているのですか?どうすれば修正できますか?また、どうすれば浮動アクションボタンがこれらのバーの上にあり、重ならないようにすることができますか?Androidボトムバーが重なっているツールバー

<?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="true" 
tools:context="com.marlonjones.kansei.MainActivity"> 
<android.support.design.widget.AppBarLayout 
    android:layout_height="wrap_content" 
    android:layout_width="match_parent" 
    app:elevation="0dp" 
    android:theme="@style/AppTheme.AppBarOverlay"> 
    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     app:elevation="4dp" 
     android:background="?attr/colorPrimary"/> 
</android.support.design.widget.AppBarLayout> 
<include layout="@layout/content_main"/> 
<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fab" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom|end" 
    android:layout_margin="@dimen/fab_margin" 
    android:src="@drawable/ic_write" /> 
<com.luseen.luseenbottomnavigation.BottomNavigation.BottomNavigationView 
    android:id="@+id/bottomNavigation" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    app:bnv_colored_background="true" 
    app:bnv_with_text="false" 
    app:bnv_shadow="true" 
    app:bnv_tablet="false" 
    app:bnv_viewpager_slide="true" 
    app:bnv_active_color="@color/colorPrimary" 
    app:bnv_active_text_size="@dimen/bottom_navigation_text_size_active" 
     app:bnv_inactive_text_size="@dimen/bottom_navigation_text_size_inactive"/> 
</android.support.design.widget.CoordinatorLayout> 

enter image description here

+0

私はそれが見えるようにするために必要な場合、マテリアルデザインスペックを参照して、また、Google Apps(バー上のFAB)をご覧ください – MJonesDev

+0

あなたはスクリーンショットを共有することができます –

+0

確かに、私は1秒。私は自分の問題と私が必要とするもののスクリーンショットを投稿します。 – MJonesDev

答えて

0

一つの解決策は、それらが動作するかどうか私は知らない、しようとするLinearLayout(または異なるLayout ManagersCoordinatorLayout内部

<?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="true" 
     tools:context="com.marlonjones.kansei.MainActivity"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 

     <android.support.design.widget.AppBarLayout 
      android:layout_height="wrap_content" 
      android:layout_width="match_parent" 
      app:elevation="0dp" 
      android:theme="@style/AppTheme.AppBarOverlay"> 
      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       app:elevation="4dp" 
       android:background="?attr/colorPrimary"/> 
     </android.support.design.widget.AppBarLayout> 
     <include layout="@layout/content_main"/> 
     <android.support.design.widget.FloatingActionButton 
      android:id="@+id/fab" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="bottom|end" 
      android:layout_margin="@dimen/fab_margin" 
      android:src="@drawable/ic_write" /> 
     <com.luseen.luseenbottomnavigation.BottomNavigation.BottomNavigationView 
      android:id="@+id/bottomNavigation" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      app:bnv_colored_background="true" 
      app:bnv_with_text="false" 
      app:bnv_shadow="true" 
      app:bnv_tablet="false" 
      app:bnv_viewpager_slide="true" 
      app:bnv_active_color="@color/colorPrimary" 
      app:bnv_active_text_size="@dimen/bottom_navigation_text_size_active" 
       app:bnv_inactive_text_size="@dimen/bottom_navigation_text_size_inactive"/> 
    </LinearLayout> 
</android.support.design.widget.CoordinatorLayout> 
3

3つの代替の方法を追加する必要があります:

1 - BottomNavigationViewをCoordinatorLayoutの外側に配置し、Relati内のすべての要素を入れ子にしますveLayoutとCoordinatorLayoutためmarginBottomを設定する(そのライブラリの例として:

android:layout_marginBottom="@dimen/bottom_navigation_height

)。

2 - それはRelativeLayoutのPARAMある(代わり

android:layout_alignParentBottom

android:layout_gravity

(CoordinatorLayoutがでframeLayoutある)CoordinatorLayout内部BottomNavigationViewを保持するが、でframeLayoutのPARAMを使用して)。 marginBottomをメインコンテンツにも追加する必要があります。

3 - であれば、より良い作品:android:layout_alignParentBottomの除去、CoordinatorLayout内BottomNavigationViewを保持し、デザインライブラリがPeekHeight XXはBottomNavigationViewの高さでなければなりません

app:behavior_peekHeight="XXdp" app:layout_behavior="android.support.design.widget.BottomSheetBehavior"

を告げると、それをBottomSheetBehaviorを与えるしようとしていますmarginBottomをメインコンテンツにも追加する必要があります。

+0

私にとっては、簡単で簡単な修正です。ありがとう – Sanny

+0

中古の第3の解決策。どうも。 – withoutname

関連する問題