6

Ich habe ein TextInputEditText in Verbindung mit TextInputLayout mit android:inputType="textPassword"app:passwordToggleEnabled="true" mit Passwort Toggle-Button in den TextInputEditText wie die nächsten Bild zeigen:

password toggle button example
Das Problem ist Sobald ich die Passwort-Umschalttaste drücke, verschwindet es für immer.
Es funktionierte gut in com.android.support:design:24.2.0 Version.
Passwort Umschaltknopf auf TextInputEditText verschwindet nach Klick in Support Library 25.1.0

vermisse ich etwas Neues? es ist ein Fehler?

Some gradle Projekt Setup:
minSdkVersion 17
targetSdkVersion 25
Kompilierung 'com.android.support:support-v4:25.1.0'
Kompilierung ‚com.android.support:appcompat-v7:25.1 0,0'
Kompilierung 'com.android.support:cardview-v7:25.1.0'
Kompilierung 'com.android.support:design:25.1.0'

Rennen in 2 verschiedenen Android 6.0 (Eibisch) Geräte.

XML:

<android.support.design.widget.TextInputLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/TextLabelGray" 
    app:passwordToggleEnabled="true"> 

    <android.support.design.widget.TextInputEditText 
     android:id="@+id/profile_field_password" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="@string/perfil_field_password" 
     android:inputType="textPassword" 
     android:maxLines="1" 
     android:maxLength="100" 
     android:imeOptions="actionNext" 
     android:imeActionLabel="@string/perfil_field_tipo_documento" 
     android:textColor="@color/colorAccent" 
     android:textSize="@dimen/perfil_text_view_text_size" 
     android:paddingStart="15dp" 
     android:paddingEnd="5dp"/> 
</android.support.design.widget.TextInputLayout> 

Wenn ich app:passwordToggleDrawable mit einem benutzerdefinierten ziehbar in TextInputLayout verwenden Sie es nicht verschwindet.

Der verwandte Stil:

<style name="TextLabelGray" parent="TextAppearance.AppCompat"> 
    <!--//hint color And Label Color in False State--> 
    <item name="android:textColorHint">@color/gray_text_color</item> 
    <item name="android:textColorHighlight">@color/gray_text_color</item> 
    <item name="android:textColorLink">@color/gray_text_color</item> 
    <item name="colorAccent">@color/gray_text_color</item> 
    <item name="colorControlNormal">@color/gray_text_color</item> 
    <item name="colorControlActivated">@color/gray_text_color</item> 
</style> 

<!-- Base application theme. --> 
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <!-- Customize your theme here. --> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
    <item name="colorControlNormal">@color/colorControlNormal</item> 

    <item name="searchViewStyle">@style/AppTheme.MySearchViewStyle</item> 
</style> 
+0

I habe den gleichen Code ausprobiert und es funktioniert. Bitte überprüfen Sie das einmal verwendete Thema . –

+0

@AndroidGeek Ich habe versucht, ohne 'android: theme =" @ style/TextLabelGray "' und was ich fand, ist die Schaltfläche nicht verschwindet, wurde es nur transparent, weil ich immer noch drücken kann und habe das Ausblenden/Einblenden Passwort Verhalten. Versucht mit einem schwarzen Hintergrund, aber immer noch das gleiche Ergebnis. Irgendeine Idee? – MiguelHincapieC

+0

Abspielen mit 'TextInputLayout' Ich habe Folgendes gefunden: Wenn ich ein benutzerdefiniertes Zeichen in 'app: passwordToggleDrawable' mit' app: passwordToggleContentDescription' verwende, verschwindet die Schaltfläche nicht – MiguelHincapieC

Antwort

1

gradle Dateiänderung durch Abhängigkeit folgenden

compile 'com.android.support:appcompat-v7:25.3.1' 
compile 'com.android.support:design:25.3.1' 
compile 'com.android.support:support-v4:25.3.1' 

In XML-Datei, fügen Sie in Passwort-Feld folgende Zeilen für Umschaltknopf

<android.support.design.widget.TextInputLayout 
android:id="@+id/text_input_layout_password" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:layout_marginTop="10dp" 
app:passwordToggleEnabled="true"> 

      <android.support.design.widget.TextInputEditText 
      android:id="@+id/text_input_edit_text_password" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="Enter Password" 
      android:imeActionId="@+id/login" 
      android:imeActionLabel="Login" 
      android:imeOptions="actionUnspecified" 
      android:inputType="textPassword" 
      android:maxLines="1" 
      tools:text="password" /> 

</android.support.design.widget.TextInputLayout> 
+0

Hallo, ty für die Antwort, aber ich denke, dass Sie es in mehr realen Geräten überprüfen müssen, weil es ein Fehler ist. Sehen Sie sich [link] (https://issuetracker.google.com/issues/37127113#makechanges) an. Ist der gleiche Link, den ich in der Frage gepostet habe. – MiguelHincapieC

Verwandte Themen