2017-02-13 5 views
0

これはXMLなぜRecyclerViewはBottomNavigationViewの下にあるのですか?

私はRecyclerView怒鳴るBottomNavigationViewを置くことができます
<android.support.design.widget.BottomNavigationView 
    android:id="@+id/bottom_navigation" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_gravity="bottom" 
    app:itemBackground="@color/colorPrimary" 
    app:menu="@menu/menus" /> 

<android.support.v7.widget.RecyclerView 
    android:id="@+id/recyclerview1" 
    android:layout_width="fill_parent" 
    android:layout_height="450dp" /> 

ための私のコードですか?

+0

あなたの活動のレイアウトとしてこれを使用するには、現在、XMLスニペットに含まれていない、あなたのレイアウトマネージャに依存します。いずれにしても、XMLで宣言されている順序を変更するか、標高を変更するのと同じくらい簡単です。 – Submersed

答えて

1

<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:id="@+id/coordinatorlayout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
<android.support.design.widget.BottomNavigationView 
    android:id="@+id/bottom_navigation" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_gravity="bottom" 
    app:itemBackground="@color/colorPrimary" 
    app:menu="@menu/menus" /> 

<android.support.v7.widget.RecyclerView 
    android:id="@+id/recyclerview1" 
    android:layout_width="fill_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    android:layout_height="450dp" /> 
</android.support.design.widget.CoordinatorLayout> 
+0

この例の詳細を教えてください。 –

+0

私の回答を編集しました@Kwik –

関連する問題