如何编辑默认导航栏

how to edit a default navigation bar

所以一个菜鸟问题:我在 Xamarin 中开始了一个带有导航栏的项目,我只想更改默认图标并根据我的应用程序更改它们下面的名称。我可以在构造函数视图中这样做吗?按钮本身已经完成了我希望它们执行的操作,但我只想更改它们的外观。 pic activity_main.xml 以防万一:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <RelativeLayout
        android:id="@+id/containerTwo"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <WebView
        android:id="@+id/webview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@id/navigation" />
        <com.google.android.material.bottomnavigation.BottomNavigationView
            android:id="@+id/navigation"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginEnd="0dp"
            android:layout_marginStart="0dp"
            android:background="?android:attr/windowBackground"
            android:layout_alignParentBottom="true"
            app:menu="@menu/navigation"
            android:accessibilityHeading="true"
        />
    
        </RelativeLayout>

</RelativeLayout>

好的,我知道了。我设法做了什么:

  • 用过这个article
  • 已安装Xamarin.Android.Support.Design
  • 已从 Asset Studio
  • 下载所需的图标
  • 解压缩带有图标的 zip 文件并将所有“可绘制”文件夹放入 Resources\drawable
  • 将 navigaton.xml 中的 android:icon 参数更改为下载的图标名称之一

注意:有时预览会乱七八糟,例如它可能会以不同比例调整图标大小,但当您模拟构建或在真实环境中执行时 phone 一切看起来都很好。