简体   繁体   English

android:TextInputLayout隐藏了子EditText的drawableRight

[英]android : TextInputLayout hides drawableRight of child EditText

I am always updated with library updates, and this is what it resulted into. 我总是更新库更新,这就是它的结果。

In build.gradle(Project:xxx): 在build.gradle(Project:xxx)中:

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

In build.gradle(Module:app) 在build.gradle中(模块: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...My Password field looks now as below: Taadaa ...我的密码字段现在如下所示:

在此输入图像描述

You can also go simply with EditText . 您也可以使用EditText

But, there are some glitches in this update. 但是,此更新中存在一些问题。

Problem: If I put any drawableRight in EditText, it displays nothing. 问题:如果我在EditText中放置任何drawableRight,它什么都不显示。 TextInputLayout also has property to disable toggle functionality. TextInputLayout还具有禁用切换功能的属性。 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>

Can anyone help me please. 任何人都可以帮助我。

I reported the issue at https://code.google.com/p/android/issues/detail?id=221002 . 我在https://code.google.com/p/android/issues/detail?id=221002上报告了该问题。

It was a bug in the library version 24.2.0 but it has been fixed in version 24.2.1 . 这是库版本24.2.0中的一个错误,但它已在版本24.2.1修复。 Simply update as below: 只需更新如下:

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

您需要将支持库升级到24.2.1(请参阅https://code.google.com/p/android/issues/detail?id=221002 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM