[FIXED] Xamarin Edit Text Keyboard Closes Instantly

Issue

Im using edit texts in my listview. But there are some issues i couldnt understand.

When i touch to Edit Text field sometimes it just closes the keyboard back instantly. I cant understand why is this happening and its happening randomly. Sometimes it opens up and sometimes it closes back. Here is my xml for edit text.

<EditText
    android:layout_width="40.0dp"
    android:layout_height="wrap_content"
    android:inputType="number"
    android:editable="true"
    android:id="@+id/siparis_adet"
    android:layout_marginTop="-60dp"
    android:layout_toRightOf="@+id/yemek_foto"
    android:layout_alignParentRight="true"
    android:layout_marginLeft="280.0dp" />

Thanks in the advance

Edit: Turns out its actually not random. It happens when i add more than 3 objects to listview.

Edit 2 : Figured out its not about the count of objects. If keyboard opens and it blocks the view of the listview object keyboard closes back. I still dont know how to fix that

Solution

Okay i fixed it by setting keyboard into Adjustpan instead of adjustResize.

[Activity(MainLauncher = false, WindowSoftInputMode = SoftInput.AdjustPan)]

Works fine now.

Answered By – MeteHan

Answer Checked By – Dawn Plyler (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published