A resource was not found that matches the specified name in layout_hint

I'm a newbie in fact, this is my first attempt at an android program. I am following the Android developer site. My activity_main.xml as follows:

 <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"/> 

Now it shows an error and a warning, for example:

Warning - This text field does not specify an inputType or a hint

Error - error:Error:No resource found that matches the given name( at 'layout_hint' with the value '@string/edit_message')

+6
source share
3 answers

You need to define the value of edit_message in the res/values/strings.xml . For a warning, check out this link .

+10
source

not android: layout_hint = "@ string / edit_message"

but android: hint = "@ string / edit_message"

0
source

I had the same problem and tried everything and I found this.

If I typed:

  android:layout_hint="@string/edit_message" 

This was red:

 "@string/edit_message" 

but if I typed:

 android:layout_hint=" @string/edit_message" 

(pay attention to "Space after the first") then this changed to green:

 " @string/edit_message" 

It worked for me.

0
source

Source: https://habr.com/ru/post/946970/


All Articles