Android中editText使用报错

时间:2021-11-12 16:20:13

在activity_main.xml文件中添加了editText控件

<EditText
        android:id="@+id/edit_text"
        android:hint="@the next"

<!--用the next或者@the next都报错,要使用@string/the next,用标准写法在string.xml文件中配置键值对(name:the next   vlaue:下一步),注意键值对有未使用的也会报错-->
        android:inputType="text"
        android:text="@string/string1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView"
        android:layout_below="@+id/textView"
        android:layout_marginTop="36dp"
        android:ems="10" />

提示error: Error: No resource type specified (at 'hint' with value '@string')

以及Hardcoded string "the next", should use @string resource

error: No resource identifier found for attribute ‘backIcon’ in package三个错误

第三个错误属于自定义控件的命名空间问题,我贴出个链接自己去看http://blog.sina.com.cn/s/blog_6aefcbed01013rpc.html  

当然我这之所以报错纯属我把inputType拼错了