无效的资源目录名称"font"; Xamarin Android [英] Invalid resource directory name "font" Xamarin Android

查看:126
本文介绍了无效的资源目录名称"font"; Xamarin Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将Visual Studio for mac升级为支持Android 8/api26.我将AppCompat库更新为26.1,以使用Android项目的Resources目录中的新字体文件夹.现在,当我尝试编译时,路径"obj/Debug/res/font" APT0000的资源目录名称无效".

I just upgraded Visual Studio for mac to support Android 8 / api 26. I updated the AppCompat library to 26.1 to use the new font folder in the Resources directory of my Android project. Now when I try to compile I get "Invalid resource directory name" for path "obj/Debug/res/font" APT0000.

推荐答案

首先请务必查看有关新功能的最新xamarin文档. https://developer.xamarin.com/guides/android/platform_features/introduction-to-oreo/

First always check out the latest xamarin documentation about new features. https://developer.xamarin.com/guides/android/platform_features/introduction-to-oreo/

我迅速创建了一个新的xamarin android项目,并添加了两个具有不同字体的textview:

I quickly created a new xamarin android project and added two textviews with diffrent fonts:

我的解决方案如下:

我通常会尝试避免在资源名称中使用大写字母,因为android studio对此有所抱怨.

I usually try to avoid capital letters in resource names as the android studio complains about it.

主要布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

  <TextView
    android:text="Pacifico example text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:fontFamily="@font/pacifico" />

  <TextView
  android:text="Roboto light example text"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:fontFamily="@font/roboto_light" />

</LinearLayout>

我认为您没有使用最新的平台来构建. 检查您是否使用最新平台(Oreo)来构建应用程序.

I think that you do not use the latest platform to build. Check that you use the latest platform (Oreo) to build the application.

这篇关于无效的资源目录名称"font"; Xamarin Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆