我有一个应用程序,我在其中编辑文本字段,我必须输入手机号码和密码。问题是,EditText
错误指示器涵盖手机号码和密码存档,并且用户将无法输入手机号码。我该如何解决这个问题?如何在android中编辑文本错误位置?
2
A
回答
8
使用此android.support.design.widget.TextInputLayout
。 它可以显示下面的错误到Edittext
.so你可以很容易地写下你的number
和password
的下一个东西在新的Edittext
。
下面是XML代码:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="60dp">
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_name"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/input_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:hint="@string/hint_name" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_email"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/input_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:hint="@string/hint_email" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_password"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/input_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:hint="@string/hint_password" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
让我们来看看屏幕截图理解。
空编辑文本。
错误消息EDITTEXT。
0
@Nitin:其实EDITTEXT行为要你专注于的EditText放弃SETERROR消息,纠正错误数据,并转到其他领域。
+0
@nitin:解决方案ironman建议是好的。它还包含了远远优越的材料设计组件。 – user492888
相关问题
- 1. 如何隐藏设置错误进入编辑文本的Android
- 2. 设置光标位置,留在编辑文本中的Android
- 3. 如何在android中以编程方式更改编辑文本的位置?
- 4. 在编辑文本中获取Android中的光标位置?
- 5. 在编辑文本中放置underbar android
- 6. 在点击位置编辑div文本
- 7. 在android中编辑文本
- 8. Android - 编辑文本错误更改键盘上的位置打开/关闭
- 9. Android屏幕方向编辑文本显示设置错误?
- 10. Android:如何在编辑文本中设置密码属性?
- 11. 如何在Android的编辑文本xml中设置水平线?
- 12. android编辑文本中的潜在错误?
- 13. 编辑文本及其光标位置?
- 14. 编辑文本光标位置
- 15. CONTENTEDITABLE文本编辑器,光标位置
- 16. 如何修复烦人的Visual Studio文本编辑器光标错位错误
- 17. 在编辑文本中设置文本时字符串资源ID错误
- 18. 如何在Android中编辑时在编辑文本中显示清除按钮
- 19. Android编辑文本
- 20. 以编程方式在android中设置编辑文本提示?
- 21. 在Visual Studio编辑器中可视化错误位置
- 22. Android位置无法输入编辑文本
- 23. Android编辑文本光标位置问题
- 24. Android位置管理器编译错误
- 25. 如何动态更改编辑文本位置
- 26. 以编程方式设置编辑文本,并找到特定的位置 - android
- 27. 在Android中编辑文本焦点
- 28. SearchToFunctionality在Android中编辑文本
- 29. 在android中编辑文本的动作
- 30. 在编辑文本中查找\ n android
显示你的布局文件和接口应该是什么 –