android - 找不到与给定名称(字符串)匹配的资源

标签 android eclipse

在我的一个布局中我需要一个字符串:

<TextView
    android:id="@+id/textViewReso"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@strings/settings_reso" />

但 Eclipse 告诉我

No resource found that matches the given name (at 'text' with value '@strings/settings_reso')

但是,这是我的 res/values/strings.xml 文件:

<?xml version="1.0" encoding="utf-8"?>

<resources>

    <string name="app_name">Crono</string>

    <string name="wallpaper_description">Fond d\'écran Crono</string>

    <string name="settings_enable_text">Activer l\'écran de veille</string>
    <string name="settings_output_text">Sortie son haut-parleur \?</string>
    <string name="settings_gallery">Galerie</string>
    <string name="settings_reso">Résolution : HD/SD</string>
    <string name= "settings_force">"Forcer la mise à jour des contenus"</string> 
    <string name="settings_time_text">Temps entre les vidéos (s)</string>
    <string name="settings_server_text">Adresse du serveur</string>

</resources>

所以居然有这样的资源!为什么它不生成我的 R 文件?是因为法语字符吗?

最佳答案

试试这个:

<TextView
        android:id="@+id/textViewReso"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="@string/settings_reso" />

只需在布局 xml 文件中将 @strings 更改为 @string

关于android - 找不到与给定名称(字符串)匹配的资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19207929/

相关文章:

android - Android OpenGL 中的平滑动画过渡逻辑

android - 一个按钮的多个 OnClickListener

android - 如何使用这种格式的 gradle 更改 apk 名称?

Android 传感器读数不返回所有传感器

android - 更新 Android Studio 3.1 后,每次构建后我都会收到这些警告

java - 从 Assets 文件夹中的文本文件加载数组 (Android)

eclipse - NoClassDefFoundError…运行方式为Groovy脚本时,org/apache/commons/cli/CommandLineParser

eclipse - 如何配置maven安装以跳过eclipse中的测试?

java - Freescale Symphony Studio 未完成安装

java - 如何在 Eclipse 中的 git 分支之间进行纯文本比较(使用 EGit)