Actuellement, je fais une activité avec Drawer Layout et TabLayout, tout comme celle sur this image. Cependant, j'ai des problèmes avec l'affichage du titre de l'onglet, qui peut être vu sur here. Bien que je puisse encore balayer vers la gauche ou la droite pour changer l'onglet visible, les titres de la barre d'onglets n'apparaissent pas.Utilisation de la disposition des tiroirs et de la disposition des onglets en même temps dans Xamarin Android
est ici la mise en page .xml pour l'activité (pour votre information, j'utilise AppCompatActivity dans le fichier d'activité pour cette mise en page):
<?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>
Je bricolé un peu avec le XML, et il est apparu que la raison pour laquelle le titre de l'onglet n'a pas pu être affiché est parce que j'ai mis le TabLayout à l'intérieur de DrawerLayout. Toutefois, en mettant le DrawerLayout en dehors de TabLayout, le contenu de chaque page à onglets n'apparaît pas.
Est-il possible d'utiliser à la fois DrawerLayout et TabLayout et d'afficher la barre de titre de l'onglet?