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.

TextInputLayout hint issue when handling FocusChange event

BCTBCT NLMember
edited July 2015 in Xamarin.Android

My app has a couple of EditTexts with a TextInputLayout wrapped around them. This works fine in most cases, but when I attach a handler to the FocusChange event of the EditText, the hint fails to animate.

I found this issue on the android forum, but he uses the OnFocusChangeListener. Proxying the call should not be necessary with events, right?
Any ideas on this issue? Is it a bug in the Xamarin android design support NuGet package?

Thanks in advance

Layout code:

    <android.support.design.widget.TextInputLayout
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content">
        <EditText
            android:id="@+id/txtProductCode"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:maxLines="1"
            android:inputType="textCapCharacters|textNoSuggestions"
            android:hint="Artikelcode" />
    </android.support.design.widget.TextInputLayout>

Fragment code:

    public override void OnStart()
    {
        base.OnStart();

        txtProductCode.FocusChange += txtProductCode_FocusChange;
         // ...
    }

    void txtProductCode_FocusChange(object sender, View.FocusChangeEventArgs e)
    {
        if (!e.HasFocus)
            txtDescription.Text = GetProductDescription();
    }

Posts

  • JasonRaiJasonRai USMember ✭✭

    I'm having the same issue.

    Haven't found a solution yet.

Sign In or Register to comment.