J'utilise ce library pour ajouter un BottomNavigationBar
à mon projet Xamarin.Android. J'utilise la méthode BottomBar.AttachShy(CoordinatorLayout, View, Bundle);
pour masquer la barre de navigation lorsque je commence à faire défiler, mais cela ne fonctionnera pas avec mon GridView
. Je fais défiler le GridView
, mais la barre de navigation persiste. Est-ce que quelqu'un sait ce que je devrais faire?Masquage BottomNavigationBar ne fonctionne pas avec la vue définie sur un GridView
Ci-dessous mon AXML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/myCoordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<GridView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnWidth="100dp"
android:numColumns="auto_fit"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:stretchMode="columnWidth"
android:gravity="center"
android:textAlignment="center"
android:id="@+id/menuGrid" />
</android.support.design.widget.CoordinatorLayout>
Voici mon code C#:
private BottomBar _bottomBar;
protected override void OnCreate(Bundle bundle) {
_bottomBar = BottomBar.AttachShy((CoordinatorLayout)FindViewById(Resource.Id.myCoordinator),
FindViewById(Resource.Id.menuGrid), bundle);
_bottomBar.UseFixedMode();
_bottomBar.SetItems(new[]
{ new BottomBarTab(Resource.Drawable.ic_recents, "Recents"),
new BottomBarTab(Resource.Drawable.ic_favorites, "Favorites"),
new BottomBarTab(Resource.Drawable.ic_nearby, "Nearby")
});
_bottomBar.MapColorForTab(0, "#7B1FA2");
_bottomBar.MapColorForTab(1, "#FF5252");
_bottomBar.MapColorForTab(2, "#FF9800");
}