如何编辑默认导航栏

时间:2021-07-04 07:30:11

标签: android xamarin xamarin.android uinavigationbar

所以一个菜鸟问题:我在 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>

1 个答案:

答案 0 :(得分:0)

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

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

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

相关问题