C# 隐藏底部导航栏不使用设置为GridView的视图
我正在使用它向我的Xamarin.Android项目添加一个C# 隐藏底部导航栏不使用设置为GridView的视图,c#,android,xamarin,xamarin.android,mvvmcross,C#,Android,Xamarin,Xamarin.android,Mvvmcross,我正在使用它向我的Xamarin.Android项目添加一个BottomNavigationBar。我使用BottomBar.AttachShy(CoordinatorLayout,View,Bundle)方法在我开始滚动时隐藏导航栏,但它不适用于我的GridView。我滚动网格视图,但导航栏仍然存在。有人知道我该怎么做吗 以下是我的AXML: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widg
BottomNavigationBar
。我使用BottomBar.AttachShy(CoordinatorLayout,View,Bundle)
方法在我开始滚动时隐藏导航栏,但它不适用于我的GridView
。我滚动网格视图
,但导航栏仍然存在。有人知道我该怎么做吗
以下是我的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>
我为任何来此帖子的人解决了这个问题。我不得不将
GridView
替换为RecyclerView
。为此,您必须实现一个适配器。我使用resource实现了我的RecyclerView
我为任何来到本文的人解决了这个问题。我不得不将GridView
替换为RecyclerView
。为此,您必须实现一个适配器。我使用了resource来实现我的RecyclerView
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");
}