在xml中添加EditText控件后提示“This text field does not specify an inputType or a hint”错误 问题描述:在xml中添加EditText控件,控件信息如下。 <EditText android:id="@+id/editText" android:layout_width="match_parent" android:layout_height="wrap_content" ></EditText> 编译时,提示“This text field does not specify an inputType or a hint”错误。 原因分析:控件中缺少android:hint以及android:inputType信息。android:hint用于设置EditText为空时显示的默认文字提示信息。android:inputType用于设置EditText的文本的类型,用于帮助输入法显示合适的键盘类型。 解决方法:在控件中添加android:hint以及android:inputType信息,添加后的控件信息如下。 <EditText android:id="@+id/editText" android:hint="0" android:inputType="number" android:layout_width="match_parent" android:layout_height="wrap_content" ></EditText>
转载于:https://www.cnblogs.com/dahui/p/6655119.html