Xamarin.Android的基本设计形状主题

问题描述

我正在尝试遵循this文档中有关形状主题的知识,但我碰壁了。

这是我的styles.xml文件:

<resources>
    <style name="AppTheme" parent="Theme.MaterialComponents.Light">
        <item name="android:windowNoTitle">true</item>
        <item name="android:colorPrimary">@color/primary</item>
        <item name="android:colorPrimaryDark">@color/primary</item>
        <item name="android:colorAccent">@color/blue</item>
        <item name="android:colorControlNormal">@color/very_light_gray</item>
        <item name="android:colorControlActivated">@color/light_gray</item>
        <item name="android:colorButtonNormal">@color/button_background</item>
        <item name="android:textColorSecondary">@color/gray</item>
        <item name="android:textColorPrimary">@color/primary_text</item>
        <item name="android:navigationBarColor">@color/primary</item>

        <item name="shapeAppearanceSmallComponent">@style/ShapeAppearance.SmallComponent</item>
        <item name="shapeAppearanceMediumComponent">@style/ShapeAppearance.MediumComponent</item>
        <item name="shapeAppearanceLargeComponent">@style/ShapeAppearance.LargeComponent</item>
    </style>

    <style name="ShapeAppearance.SmallComponent" parent="ShapeAppearance.MaterialComponents.SmallComponent">
        <item name="cornerFamily">cut</item>
        <item name="cornerSize">4dp</item>
    </style>

    <style name="ShapeAppearance.MediumComponent" parent="ShapeAppearance.MaterialComponents.MediumComponent">
        <item name="cornerFamily">cut</item>
        <item name="cornerSize">8dp</item>
    </style>

    <style name="ShapeAppearance.LargeComponent" parent="ShapeAppearance.MaterialComponents.LargeComponent">
        <item name="cornerFamily">rounded</item>
        <item name="cornerSize">4dp</item>
    </style>
</resources>

当我去构建我的应用程序时,我得到一个错误列表:

figure-1

这是我安装的软件包:

figure-2

我不确定是否缺少软件包,或者Xamarin.Android是否尚未支持此软件包。我知道还有其他方法可以做到这一点,但如果可以的话,我更愿意这样做。

解决方法

尝试将Xamarin.Google.Android.Material nuget更新到最新版本,然后安装Xamarin.AndroidX.Legacy.Support.Core.UI nuget,它对我有用。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...