2017-05-10 10 views
2

응용 프로그램을 만들고 있는데 응용 프로그램에 탐색 창과 하단 막대가 있습니다.동일한 응용 프로그램에서 탐색 창과 하단 막대를 만드는 방법

좋은 방향으로 가고 있다고 생각하지만, 표시 할 때 탐색 용 서랍을 수행 할 수 있습니다.이 것은 하단 바 위에 있지 않으므로 뒤에 있습니다. 어떻게 할 수 있습니까? 아래쪽 막대의 내비게이션 창을 필요합니다.

내 코드, 난

<?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" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 


    <android.support.v4.widget.DrawerLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

    <include 
      layout="@layout/include_list_viewpager" />- 

    <android.support.design.widget.NavigationView 
     android:id="@+id/nav_view" 
     android:layout_height="match_parent" 
     android:layout_width="300dp" 
     android:layout_gravity="start" 
     android:fitsSystemWindows="true" 
     app:headerLayout="@layout/nav_header" 
     app:menu="@menu/drawer_view" /> 

    </android.support.v4.widget.DrawerLayout> 


    <android.support.design.widget.BottomNavigationView 
     android:id="@+id/bottom_navigation" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     app:itemBackground="@color/colorPrimaryRed" 
     app:itemTextColor="@drawable/nav_item_color_state" 
     app:itemIconTint="@drawable/nav_item_color_state" 
     app:menu="@menu/navigation" /> 


</RelativeLayout> 

답변

5
<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout 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/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true" 
tools:openDrawer="start"> 
<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    > 
    <include 
     ----- text showing -----/> 

    <android.support.design.widget.BottomNavigationView 
     android:id="@+id/navigation" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:background="@color/colorPrimary" 
     app:itemTextColor="@color/colorAccent" 
     app:itemIconTint="@color/colorWhite" 
     app:menu="@menu/bottom_navigation_item"/> 
</RelativeLayout> 

<android.support.design.widget.NavigationView 
    android:id="@+id/nav_view" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    android:fitsSystemWindows="true" 
    app:headerLayout="@layout/nav_header_main" 
    app:menu="@menu/activity_main_drawer" /> 

+0

이 시도 ter216 @ 나던, 다른 아무것도 알려 경우 –

+0

Hooo 덕분에 너는 너무, 완벽하게 작동한다 = D – ter2016

+0

좋아, 너는 내 대답을 받아 들일 수있어. 어. –

1

N, N- 감사 문제에 대한 두 가지 해결책이있다, 당신이 날 도울 수 있기를 바랍니다.

  1. 매우 쉽습니다. BottomNavigationView에 특정 높이를 부여하십시오. 예를 들어 56dp을 입력 한 다음 marginBottomNavigationView으로 지정하십시오.
  2. 그대로 유지하십시오. DrawerLayout의 속성을 layout_above="@+id/bottom_navigation으로 지정하십시오.
+0

그것은 작품 = ( – ter2016

0

당신은 시도 할 수

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout 
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" 
tools:context="com.example.chuks.vibefmbenin.MainActivity" 
android:id="@+id/drawer_layout">` 
<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 
    </LinearLayout> 


<!-- The main content that loads the fragments --> 
<FrameLayout 
    android:id="@+id/frament_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"/> 

<!--setting the corodinator layout inorder to pull the bottom navigation view down to the bottom--> 
<android.support.design.widget.CoordinatorLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content">` <!--The bottom navigation --> 
<android.support.design.widget.BottomNavigationView 
    android:id="@+id/navigationBottom" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom" 
    android:background="?android:attr/windowBackground" 
    app:menu="@menu/navigation_bottom"/> 

</android.support.design.widget.CoordinatorLayout> 

<!-- The navigation drawer that comes from the left --> 
<!-- Note that `android:layout_gravity` needs to be set to 'start' --> 
<android.support.design.widget.NavigationView 
    android:id="@+id/navigation_view" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:menu="@menu/navigation_menu" 
    android:layout_gravity="start" 
    app:headerLayout="@layout/navigation_header"> 

</android.support.design.widget.NavigationView>