app: passwordToggleEnabled = "true" не работает - PullRequest
0 голосов
/ 15 мая 2018

Я пытаюсь реализовать страницу входа в систему, и это мое 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" не работает.

enter image description here

Вот мой импорт 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'

Edit:

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>

Есть идеи, почему это не работает?

Ответы [ 2 ]

0 голосов
/ 17 мая 2018

Это было там все это время, но оно было белым, поэтому я не мог его увидеть. Я только что включил эту одну строку кода:

app:passwordToggleTint="@color/blue"

enter image description here

0 голосов
/ 15 мая 2018

Уважаемый @Dale Джулиан, нет необходимости ставить app: passwordToggleDrawable = "@ drawable / eye_outline". Android получит его прямо с ресурсов Android.

...