TextinputLayout的错误提示的一些问题

陆羽_ 2016-07-01 11:31:12
这两天使用textinputlayout的时候发现一个问题,如果输入的内容为错误的话,会吧EditText变成红色,之后即使输入正确也不会变回原来的颜色。有什么好的解决办法么?谢谢



 <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
...全文
493 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
xmlns:app="http://schemas.android.com/apk/res-auto" http://stackoverflow.com/questions/33247656/textinputlayout-design-support-library-doesnt-show-setcounterenable-method-an
DavinBin 2016-07-10
  • 打赏
  • 举报
回复
我也是这种情况,问题解决了吗?
网易云捕 2016-07-01
  • 打赏
  • 举报
回复
jklwan 2016-07-01
  • 打赏
  • 举报
回复
升级一下support-design库,以前的版本有bug。 你说的没有那两个属性也是新版本加的属性,旧版本是没有的。 可以使用23.4.0或最新的24.0.0版本的库。

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧