0

저는 현재 서랍 레이아웃과 TabLayout을 사용하여 this image과 같은 활동을합니다. 그러나 실제로는 here에서 볼 수있는 탭 제목을 표시하는 데 문제가 있습니다. 표시된 탭을 변경하기 위해 왼쪽 또는 오른쪽으로 여전히 스 와이프 할 수 있지만 탭 표시 줄 제목은 표시되지 않습니다. 여기 Xamarin 안드로이드에서 서랍 레이아웃과 탭 레이아웃을 동시에 사용하기

은 (내가 레이아웃의 활동 파일에 AppCompatActivity을 사용하고 귀하의 정보에 대한) 활동에 대한 .XML 레이아웃이다 : 나는 XML을 조금 주위를 만지작

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:minWidth="25px" 
    android:minHeight="25px" 
    android:background="@android:color/white"> 

<android.support.v7.widget.Toolbar 
    android:id="@+id/toolBar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:minHeight="?attr/actionBarSize" 
    android:background="?attr/colorPrimary" 
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
    app:popupTheme="@style/ThemeOverlay.AppCompat.Dark" /> 

<android.support.v4.widget.DrawerLayout 
    android:id="@+id/drawerLayout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 


<!-- The Main Content View --> 
<android.support.design.widget.TabLayout 
    android:id="@+id/request_tabs" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    app:tabMode="fixed" 
    app:tabGravity="fill" 
    android:background="@color/colorPrimary" /> 
<android.support.v4.view.ViewPager 
     android:id="@+id/viewpager" 
     android:layout_width="match_parent" 
     android:layout_height="0px" 
     android:layout_weight="1" 
     android:background="@android:color/white" /> 

<!-- The Left Navigation Drawer --> 
    <ListView 
     android:id="@+id/leftDrawer" 
     android:layout_width="240dp" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     android:choiceMode="singleChoice" 
     android:divider="#818181" 
     android:dividerHeight="2dp" 
     android:background="#E3F2FD" /> 

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

</LinearLayout> 

, 그리고 등장 탭 제목을 표시 할 수없는 이유는 DrawLayout 내부에 TabLayout을 배치했기 때문입니다. 그러나 DrawLayout을 TabLayout 외부에두면 각 탭 페이지의 내용이 나타나지 않습니다.

DrawerLayout과 TabLayout을 모두 사용하고 탭 제목 표시 줄을 표시 할 수있는 방법이 있습니까?

답변

0

TabLayoutDrawerLayout 안에 넣는 데 문제가 없어야하며, the answers in this thread을 확인하십시오.

코드에서 발견 한 유일한 문제는 DrawerLayout이 레이아웃의 루트보기가 아니라는 것입니다. 이 컨트롤을 사용할 때는 루트보기로 디자인해야합니다.

관련 문제