TextinputLayout的错误提示的一些问题

移动开发 码拜 8年前 (2016-03-23) 1618次浏览
        这两天使用textinputlayout的时候发现一个问题,假如输入的内容为错误的话,会吧EditText变成红色,之后即使输入正确也不会变回原来的颜色。有什么好的解决办法么?谢谢TextinputLayout的错误提示的一些问题
TextinputLayout的错误提示的一些问题

 <android.support.design.widget.TextInputLayout
            android:id="@+id/usernameWrapper"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            style="@style/TextInputLayoutTheme"
            app:errorEnabled="true">
            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:backgroundTint="@color/blue"
                android:hint="Username"
                android:inputType="textEmailAddress"
                android:textColor="@color/black" />
        </android.support.design.widget.TextInputLayout>


app:counterEnabled=”true”
app:counterMaxLength=”5″

还有一个问题,本人在代码里加入这两个属性之后报错,提示
Error:(22) No resource identifier found for attribute “counterEnabled” in package
Error:(22) No resource identifier found for attribute “counterMaxLength” in package

解决方案

40

升级一下support-design库,以前的版本有bug。
你说的没有那两个属性也是新版本加的属性,旧版本是没有的。
可以使用23.4.0或最新的24.0.0版本的库。

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明TextinputLayout的错误提示的一些问题
喜欢 (0)
[1034331897@qq.com]
分享 (0)