tInputLayout隐藏子EditText的drawable

tInputLayout隐藏子EditText的drawable

本文介绍了android:TextInputLayout隐藏子EditText的drawableRight的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我总是在更新库更新,这就是结果.

I am always updated with library updates, and this is what it resulted into.

在build.gradle(Project:xxx)中:

In build.gradle(Project:xxx):

classpath 'com.android.tools.build:gradle:2.2.0-beta1'

在build.gradle(Module:app)

In build.gradle(Module:app)

compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0'

然后输入密码字段,如下所示:

And put password field as below:

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.AppCompatEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>

Taadaa ...我的密码字段现在如下所示:

Taadaa...My Password field looks now as below:

您也可以简单地使用EditText.

但是,此更新中存在一些故障.

But, there are some glitches in this update.

问题:如果将任何drawableRight放在EditText中,则不显示任何内容. TextInputLayout还具有禁用切换功能的属性.我也做了以下操作,但没有成功:

Problem:If I put any drawableRight in EditText, it displays nothing. TextInputLayout also has property to disable toggle functionality. I did it that too as below, but no success:

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:passwordToggleEnabled="false">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:drawableRight="@drawable/ic_alarm_on_black_24dp"
        android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>

有人可以帮我吗?

推荐答案

我在 https://code.google.com/p/android/issues/detail?id=221002 .

这是库版本24.2.0中的错误,但已在版本24.2.1中修复.只需更新如下:

It was a bug in the library version 24.2.0 but it has been fixed in version 24.2.1. Simply update as below:

compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'

这篇关于android:TextInputLayout隐藏子EditText的drawableRight的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 19:40