私は私の断片のためにFramelayoutでGoogle Support Library BottomNavigationViewを試しました。ここでRecyclerviewで覆われたBottomNavigationView
は私のコード
<?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.bottombarnavigation.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<include layout="@layout/toolbar"/>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
<android.support.design.widget.BottomNavigationView
android:background="#fcfcfc"
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
app:menu="@menu/bottom_navigation" />
</android.support.design.widget.CoordinatorLayout>
私はフラグメント内の私のRecyclerviewを移入すると、それはBottomNavigationViewにより、コンテンツまでカバーしています。
私はこれがなぜ起こるかわかりません。私は他の人のチュートリアルを見て、それは正常に動作します。ここでEDIT
はあなたの親のレイアウト私は、電子コーディネーターのレイアウトは、デフォルトの動作が配置さでframeLayoutを拡張するため、代わりにwrap_contentのBottomNavigationViewのために、DPにおけるいくつかの静的な高さを与える私のcontent_main.xmlファイル
<?xml version="1.0" encoding="utf-8"?>
<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:background="@android:color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.bottombarnavigation.MainActivity"
tools:showIn="@layout/activity_main">
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"></FrameLayout>
</RelativeLayout>
は、この[リンク]を試してみてください(http://stackoverflow.com/a/40153446/2891686)。私は、属性app:layout_anchorとapp:layout_anchorGravityは欠けていると思います。 –
@DmitriyKaluzhin私はそれを試したところ、結果は同じです。 recyclerviewの内容はまだbottomnavigationviewの背後にある –
あなたはこの問題の答えを見つけましたか? –