Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/207.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 隐藏底部导航栏不使用设置为GridView的视图_C#_Android_Xamarin_Xamarin.android_Mvvmcross - Fatal编程技术网

C# 隐藏底部导航栏不使用设置为GridView的视图

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

我正在使用它向我的Xamarin.Android项目添加一个
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");
}