android : TextInputLayout 隐藏子 EditText 的 drawableRight
android : TextInputLayout hides drawableRight of child EditText
我总是随着图书馆的更新而更新,这就是它的结果。
在 build.gradle(项目:xxx)中:
classpath 'com.android.tools.build:gradle:2.2.0-beta1'
在 build.gradle(模块:应用)
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0'
并将密码字段设置如下:
<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...我的密码字段现在如下所示:
您也可以简单地使用 EditText
。
但是,这次更新有一些小问题。
问题:
如果我在 EditText 中放置任何 drawableRight,它什么也不显示。 TextInputLayout 也有 属性 来禁用切换功能。我也这样做了,如下所示,但没有成功:
<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>
谁能帮帮我。
您需要将支持库升级到 24.2.1(参见 https://code.google.com/p/android/issues/detail?id=221002)。
我在 https://code.google.com/p/android/issues/detail?id=221002 报告了这个问题。
这是库版本 24.2.0
中的错误,但已在版本 24.2.1
中修复。只需更新如下:
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
我总是随着图书馆的更新而更新,这就是它的结果。
在 build.gradle(项目:xxx)中:
classpath 'com.android.tools.build:gradle:2.2.0-beta1'
在 build.gradle(模块:应用)
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0'
并将密码字段设置如下:
<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...我的密码字段现在如下所示:
您也可以简单地使用 EditText
。
但是,这次更新有一些小问题。
问题: 如果我在 EditText 中放置任何 drawableRight,它什么也不显示。 TextInputLayout 也有 属性 来禁用切换功能。我也这样做了,如下所示,但没有成功:
<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>
谁能帮帮我。
您需要将支持库升级到 24.2.1(参见 https://code.google.com/p/android/issues/detail?id=221002)。
我在 https://code.google.com/p/android/issues/detail?id=221002 报告了这个问题。
这是库版本 24.2.0
中的错误,但已在版本 24.2.1
中修复。只需更新如下:
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'