Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Possible bug with Password Visibility Toggle with InputTextLayout (Android Support Library)

USING XAMARIN.ANDROID IN VISUAL STUDIO 2015

Add a TextInputLayout with a TextInputEditText inside, enable the Password Visibility Toggle in the TextInputLayout and toggle.
Sample:
<android.support.design.widget.TextInputLayout
android:id="@+id/textInputLayoutPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
local:passwordToggleEnabled="true">
<android.support.design.widget.TextInputEditText
android:id="@+id/txtPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>

Android 4.4 - API 19 emulator:
Behaviour is as expected, password visibility toggles.

Android 5.0 - API 21 emulator:
Throws an exception when trying to toggle:
04-12 15:46:40.045 E/AndroidRuntime( 1681): FATAL EXCEPTION: main
04-12 15:46:40.045 E/AndroidRuntime( 1681): Process: TestDevices.Droid.TestDevices.Droid, PID: 1681
04-12 15:46:40.045 E/AndroidRuntime( 1681): java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.graphics.drawable.AnimatedVectorDrawable.start(AnimatedVectorDrawable.java:423)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.graphics.drawable.AnimatedStateListDrawable$AnimatedVectorDrawableTransition.start(AnimatedStateListDrawable.java:322)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.graphics.drawable.AnimatedStateListDrawable.selectTransition(AnimatedStateListDrawable.java:226)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.graphics.drawable.AnimatedStateListDrawable.onStateChange(AnimatedStateListDrawable.java:153)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.graphics.drawable.Drawable.setState(Drawable.java:598)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.support.v4.graphics.drawable.DrawableWrapperGingerbread.setState(DrawableWrapperGingerbread.java:145)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.support.v4.graphics.drawable.DrawableWrapperLollipop.setState(DrawableWrapperLollipop.java:95)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.widget.ImageView.drawableStateChanged(ImageView.java:1108)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.support.v7.widget.AppCompatImageButton.drawableStateChanged(AppCompatImageButton.java:149)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.view.View.refreshDrawableState(View.java:15931)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.support.design.widget.CheckableImageButton.setChecked(CheckableImageButton.java:75)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.support.design.widget.TextInputLayout.passwordVisibilityToggleRequested(TextInputLayout.java:1302)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.support.design.widget.TextInputLayout$4.onClick(TextInputLayout.java:1076)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.view.View.performClick(View.java:4756)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.view.View$PerformClick.run(View.java:19749)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.os.Handler.handleCallback(Handler.java:739)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.os.Handler.dispatchMessage(Handler.java:95)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.os.Looper.loop(Looper.java:135)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at android.app.ActivityThread.main(ActivityThread.java:5221)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at java.lang.reflect.Method.invoke(Native Method)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at java.lang.reflect.Method.invoke(Method.java:372)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
04-12 15:46:40.045 E/AndroidRuntime( 1681): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

Android 6.0 - API 23 - emulator and Nexus 5 device:
When you tap the password visibility toggle, it actually toggles, but the icon dissapears, still toggleable, but icon is not visible anymore.

Is this actually a bug, or a problem with my project?

Sign In or Register to comment.