So to solve the issue you need to remove the focus from the EditText field. How to achieve that simple task? Well after trying out several solutions I found that adding an invisible LinearLayout before any EditText, AutoCompleteTextView, SearchView etc. on your screen layout will do the job. This LinearLayout will grab the focus from the EditText without giving it to an other editable element.
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:id="@+id/itemText" android:text="Item Number:" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_below="@id/locations" android:textStyle="bold" /> <LinearLayout android:focusable="true" android:focusableInTouchMode="true" android:layout_width="0px" android:layout_height="0px" /> <EditText android:id="@+id/itemNumber" android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_below="@id/itemText" /> <Button android:text="Submit" android:layout_height="wrap_content" android:id="@+id/itemInfo" android:layout_below="@id/itemNumber" android:layout_width="wrap_content" />
In case you found a better solution please share it!
No comments:
Post a Comment
NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.