Android:edittext警报
是否可以在编辑文本中创建警报? 我在两个应用程序中看到过完全相同的样式,所以我知道这是一个默认视图或属性 您必须使用 有几个值可以设置为测试属性:Android:edittext警报,android,xml,android-layout,android-studio,android-alertdialog,Android,Xml,Android Layout,Android Studio,Android Alertdialog,是否可以在编辑文本中创建警报? 我在两个应用程序中看到过完全相同的样式,所以我知道这是一个默认视图或属性 您必须使用 有几个值可以设置为测试属性: regexp:用于自定义regexp 数字:仅用于数字字段 alpha:仅用于alpha字段 字母数字: personName:检查输入的文本是人名还是姓氏 personFullName:检查输入的值是否为完整的全名 电子邮件:检查该字段是否为有效电子邮件 creditCard:使用Luhn算法检查字段是否包含有效的信用卡 电话:检查字段是否包含有
editText.setError("Enter yor error message").
从android设计库中,不使用EditText小部件,一个解决方案是一个RelativeLayout,带有自动完成的TextView小部件和您选择的警报图标,设置在RL内AC TextView的右侧
然后在AC textview中添加一个文本更改侦听器,该侦听器正在查找您的特定文本输入,即二进制,如果检测到违规,则显示警告和错误图标 您是否检查了EditText的setError方法?
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
<EditText
android:id="@+id/phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:hint="@string/cont_num"
android:inputType="phone"/>
</android.support.design.widget.TextInputLayout>