This error shows up when I was writing my code. error:
Error: No resource found that matches the given name (at 'hint' with value '@string/edit_message').
The code is:
<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" >
<EditText android:id="@+id/edit_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/edit_message" />
</LinearLayout>
That is easy.Just add a item like this in your res/values/strings.xml
file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="edit_message">YOUR MESSAGE TEXT</string>
</resources>
The default string resources folder android generates called strings, did you write the XML manually or it is a generated code? if manually, try to fix it:
android:hint="@strings/edit_message"
Set hint on edittext like this from programmatically if resource is not found in your application:
editMessage.setHint("hint message"):
or you can simply Call setHint() on the EditText.
Refer: http://developer.android.com/reference/android/widget/TextView.html#setHint%28int%29
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.