我正在尝试实现一个登录页面,这是我的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>
但不知怎的,app:passwordToggleEnabled="true"
似乎无法发挥作用。
以下是我的gradle导入:
compile 'com.android.support:design:27.1.1'
compile 'com.android.support:support-v4:27.1.1'
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.android.support:recyclerview-v7:27.1.1'
compile 'com.android.support:support-vector-drawable:27.1.1'
compile 'com.android.support.constraint:constraint-layout:1.1.0'
compile 'com.android.support:recyclerview-v7:27.1.1'
compile 'com.android.support:cardview-v7:27.1.1'
编辑:
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>
知道为什么这不起作用吗?