xamarin - 更改 Xamarin Forms NavigationPage 工具栏的高度

标签 xamarin xamarin.android xamarin.forms

我正在尝试使用 AppCompat 更改在 Android 上呈现的 Xamarin 表单工具栏的高度。表单中没有高度属性来设置它,所以我尝试设置 layout_heighttoolbar.axml如下

<android.support.v7.widget.Toolbar 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="128dp"
    android:minHeight="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    app:layout_scrollFlags="scroll|enterAlways" />

这不会改变高度。

我也试过设置
  • 机器人:最小高度
  • 机器人:高度
  • 高度
  • android:actionBarSize

  • 但那些也不会改变高度。

    FWIW,当将 Xamarin Forms non-AppCompat NavigationPage 与 ActionBar 一起使用时,我能够使用 android:height 设置高度.

    最佳答案

    我发现以下内容对同一问题非常有帮助。

    Xamarin Forms: How to change Toolbar height in Android?

  • 添加 <item name="android:actionBarSize">250dp</item>进入你的styles.xml
  • 删除 android:layout_height="wrap_content"来自 Toolbar.axml。

  • 这应该可以让您定义导航栏所需的任何高度。

    希望有帮助

    关于xamarin - 更改 Xamarin Forms NavigationPage 工具栏的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37689696/

    相关文章:

    c# - 绑定(bind)到 Text 属性 ios-unified 不起作用

    visual-studio - Visual Studio 的 AndroidApkSigner 在 keystore 中找不到 key

    c# - 如何在 Xamarin 中使用 SetAction

    xamarin - 将 Xamarin.Android 应用迁移到 Xamarin.Forms 应用

    c# - 我无法访问 x :Name of controls in ListView in XAML and Code behind

    c# - Xamarin 形式 : tooltip in windows app

    android - Xamarin Forms Android透明状态栏

    xamarin - 如何在 Xamarin.Forms 中为标签中的单个单词加下划线?

    c# - IOS Xamarin 中的自动完成

    c# - 无法将 JSON 写入文件 (Xamarin C#)