码迷,mamicode.com
首页 > 其他好文 > 详细

<EditText /> This text field does not specify an inputType or a hint

时间:2014-09-10 02:41:09      阅读:137      评论:0      收藏:0      [点我收藏+]

标签:android   style   blog   http   color   os   ar   for   div   

我是一个警告,xml代码是:

<EditText
    android:id="@+id/str_ipaddress"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:ems="10"
    android:inputType="text" />

改成

<EditText
    android:id="@+id/str_ipaddress"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:ems="10"
    android:inputType="text"
    android:labelFor="@id/str_ipaddress" />

就好了。

为什么,因为新版本SDK要求填写属性lableFor,类似于填写一个ID来绑定这个控件,第一句已经添加了一个id,直接用那个就行了

 

 

 

This text field does not specify an inputType or a hint

1 <EditText
2         android:layout_width="fill_parent"
3         android:layout_height="wrap_content"
4         android:minLines="3"
5         android:id="@+id/message"
6         />

        这样写的时候突然发现有黄色的叹号出现,提示:"This text field does not specify an inputType or a hint";

        原因是这个编辑框缺少一个属性:hint。

        hint属性作用如下:

        bubuko.com,布布扣

    修改后代码为:   

bubuko.com,布布扣
1 <EditText
2         android:layout_width="fill_parent"
3         android:layout_height="wrap_content"
4         android:minLines="3"
5         android:hint="@null"
6         android:id="@+id/message"
7         />
bubuko.com,布布扣

   添加后黄色叹号就消失了。

<EditText /> This text field does not specify an inputType or a hint

标签:android   style   blog   http   color   os   ar   for   div   

原文地址:http://www.cnblogs.com/chen-lhx/p/3963658.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!