我正在尝试使用 AppCompat 更改在 Android 上呈现的 Xamarin 表单工具栏的高度。表单中没有高度属性来设置它,所以我尝试设置 layout_height
在 toolbar.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" />
这不会改变高度。
我也试过设置
但那些也不会改变高度。
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/