我是一个警告,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属性作用如下:

    修改后代码为:  

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

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

<EditText /> This text field does not specify an inputType or a hint的更多相关文章

  1. EditText html 出现提示 This text field does not specify an inputType or a hint

      1 <EditText 2 android:layout_width="fill_parent" 3 android:layout_height="wrap_c ...

  2. This text field does not specify an inputType or a hint

    android开发过程中突然发现的warning,EditText 报出 “This text field does not specify an inputType or a hint”   原因: ...

  3. 编辑控件的警告提示是:This text field does not specify an inputType or a hint

    没有设置editText的inputtype属性,比如<android:inputtype="textpassword"> http://binuu.blog.51ct ...

  4. 从零开始学ios开发(四):IOS控件(1),Image View、Text Field、Keyboard

    长话短说,谢谢大家的关注,这篇写了好长时间,下面继续学习ios.我将用2到3篇的篇幅来学习iphone上的一些常用控件,包括Image View.Text Field.Keyboard.Slider等 ...

  5. 当开始输入文字以及完成文字输入时,变换text field的背景以及系统自带一键删除的 叉叉

    当开始输入文字以及完成文字输入时,变换text field的背景. -(BOOL) textFieldShouldBeginEditing:(UITextField *)textField{ [tex ...

  6. 限制 Text Field 输入的内容类型:只允许输入数字

    效果如下: ViewController.h #import <UIKit/UIKit.h> @interface ViewController : UIViewController< ...

  7. 一行代码轻松修改 Text Field 和 Text View 的光标颜色 — By 昉

    众所周知,Text Field 和 Text View 的光标颜色默认都是系统应用的那种蓝色,如图: 而在实际开发中为了让视觉效果更统一,我们可能会想把那光标的颜色设置成和界面色调一致的颜色.其实在 ...

  8. 问题; No label views point to this text field with an android:labelFor="@+id/@+id/editTextNumber1" attribute

    设置完EditText的ID后老是报一个警告. 解决方法: 需要在EditText属性中添加inputType和labelFor两个属性.其中labelFor属性的值与id值相同即可

  9. SQL Server text field里面有换行符的时候copy到excel数据会散乱

    解决方法: select '"'+convert(varchar(8000),testField)+'"'astestField from testTable 这样虽然结果集里面有 ...

随机推荐

  1. treeview树形菜单,递归

    我使用的是递归是实现无限级树形菜单: using System; using System.Collections; using System.Configuration; using System. ...

  2. 《Windows核心编程》第一讲 对程序错误的处理

    一个Windows函数通常都有一个有意义的返回值类型,它标志着这个函数的运行状态,即函数运行成功与否.windows常用的函数类型如下图: 从系统内部来讲,当一个Windows函数检测到一个错误时,它 ...

  3. 分享一些免费的,开源的邮件server软件

    因为企业的须要,我们非常可能须要架设一个邮件server,微软的Exchange太复杂?GOOGLE出来的又收费!头大了吧,OK,贾芸斐在这里给大家分享推荐几个免费的开源的邮件server软件.希望你 ...

  4. [置顶] head first 设计模式之----Observer pattern

    浅谈设计模式之----观察者模式      观察者模式也是我们日常程序编写中碰到比较多的一种设计模式.首先,所谓观察者模式定义就是指:在对象之间定义了一对多的依赖,这样一来,当一个对象的状态发生变化的 ...

  5. MVP模式在Android开发中的应用

    一.MVP介绍      随着UI创建技术的功能日益增强,UI层也履行着越来越多的职责.为了更好地细分视图(View)与模型(Model)的功能,让View专注于处理数据的可视化以及与用户的交互.同一 ...

  6. Java Web Services (2) - 第2章 启动日志分析

    ZHAOFLIU-Mac:dev liuzhaofu$ ./start --seed########################################################## ...

  7. JS Bin Tips and Bits • About

    JS Bin Tips and Bits • About   About Who built this? JS Bin was built by Remy Sharp and is completel ...

  8. js封装的类似java StringBuilder类

    使用js的时候,经常会使用字符串拼接,但是在IE6和IE7没有对+作优化,所以性能会很低,鉴于此,我封装了StringBuilder类,用于拼接字符串,直接把代码贴出来如下: function Str ...

  9. Qt中无处不在的d指针为何方神圣

    在研究QCoreApplication类的代码时,无意间弄明白了“d_func()”和“d指针”的来源: class Q_CORE_EXPORT QCoreApplication#ifndef QT_ ...

  10. SQL SERVER CHARINDEX函数

    CHARINDEX函数经常常使用来在一段字符中搜索字符或者字符串.假设被搜索的字符中包括有要搜索的字符,那么这个函数返回一个非零的整数,这个整数是要搜索的字符在被搜索的字符中的開始位数.即CHARIN ...