Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在布局提示中未找到与给定名称匹配的资源_Android_Xml_Sdk - Fatal编程技术网

Android 在布局提示中未找到与给定名称匹配的资源

Android 在布局提示中未找到与给定名称匹配的资源,android,xml,sdk,Android,Xml,Sdk,我是新手,其实这是我第一次尝试android程序。我正在关注android开发者培训网站。我的活动\u main.xml如下所示: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="ma

我是新手,其实这是我第一次尝试android程序。我正在关注android开发者培训网站。我的
活动\u main.xml
如下所示:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"

tools:context=".MainActivity" >

<EditText android:id="@+id/edit_message"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    android:layout_hint="@string/edit_message"/>

现在,它显示一个错误和警告,如:

警告-
此文本字段未指定输入类型或提示


错误-
错误:错误:未找到与给定名称匹配的资源(在“布局提示”处,其值为“@string/edit\u message”)
您需要在
res/values/strings.xml
文件中定义
edit\u message
的值。关于警告,请查看。

非android:layout\u hint=“@string/edit\u message”


但是android:hint=“@string/edit_message”

我也遇到了同样的问题,并尝试了各种方法,这就是我发现的

如果我键入:

 android:layout_hint="@string/edit_message"
android:layout_hint=" @string/edit_message" 
这是红色的:

"@string/edit_message"
但如果我打字:

 android:layout_hint="@string/edit_message"
android:layout_hint=" @string/edit_message" 
(注意第一个后面的空格) 然后变为绿色:

" @string/edit_message"

这对我很有效。

非常感谢。错误现在已经消失。但我仍然收到警告消息。