Java 应用程序:passwordToggleEnabled=";“真的”;不起作用
我正在尝试实现一个登录页面,这是密码字段的Java 应用程序:passwordToggleEnabled=";“真的”;不起作用,java,android,passwords,android-textinputlayout,textinputlayout,Java,Android,Passwords,Android Textinputlayout,Textinputlayout,我正在尝试实现一个登录页面,这是密码字段的TextInputLayout <android.support.design.widget.TextInputLayout android:id="@+id/password" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="15dp
TextInputLayout
<android.support.design.widget.TextInputLayout
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:hint="Password"
app:passwordToggleDrawable="@drawable/eye_outline"
android:theme="@style/GFSTextInputLayoutTheme"
app:passwordToggleEnabled="true">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:textColor="@color/black"
android:textColorHint="@color/light_grey"
android:textSize="20dp" />
</android.support.design.widget.TextInputLayout>
编辑:
styles.xml
<style name="GFSTextInputLayoutTheme" parent="TextAppearance.AppCompat">
<!-- Hint color and label color in FALSE state -->
<item name="android:textColorHint">@color/light_grey</item>
<!-- Label color in TRUE state and bar color FALSE and TRUE State -->
<item name="colorAccent">@color/light_grey</item>
<item name="colorControlNormal">@color/light_grey</item>
<item name="colorControlActivated">@color/gfs_blue</item>
</style>
@颜色/浅灰色
@颜色/浅灰色
@颜色/浅灰色
@颜色/gfs\U蓝色
你知道这为什么不起作用吗?亲爱的@Dale Julian,没有必要把app:passwordToggleDrawable=“@drawable/eye\u outline”放在这里。Android将直接从Android资源中获取它。它一直在那里,但它是白色的,所以我看不到它。我只包含了这一行代码:
app:passwordToggleTint="@color/blue"
相同的代码正在运行在我的设备中查找与共享您的
@style/GFSTextInputLayoutTheme
主题question@NileshRathod在文章中添加了布局主题。即使我删除了,它仍然无法工作。我只是尝试手动添加一个drawable,如果可以的话。但不幸的是,它不是。你的代码似乎是正确的,只有我也尝试过,与我工作良好。请在删除app:passwordToggleDrawable=“@drawable/eye_outline”android:theme=“@style/GFSTextInputLayoutTheme”这些代码行后重试。仍然不起作用。我将尝试一个新的项目。
app:passwordToggleTint="@color/blue"