Question Detail

I am having a strange Problem. When I enter in Activity Automatically EditText get Focused and Keyboard got raise up. Only when a user clicks on EditText it will Focus otherwise not. How can we Control this?

Image result for auto focus edittext android


Thread Reply

Bili Greed

- 1 years ago

A good code sample is missing:

<!-- Dummy item to prevent AutoCompleteTextView from receiving focus -->
<LinearLayout
    android:focusable="true" 
    android:focusableInTouchMode="true"
    android:layout_width="0px" 
    android:layout_height="0px"/>

<!-- :nextFocusUp and :nextFocusLeft have been set to the id of this component
to prevent the dummy from receiving focus again -->
<AutoCompleteTextView android:id="@+id/userId_Autocomplete_ID"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:nextFocusUp="@id/userId_Autocomplete_ID" 
    android:nextFocusLeft="@id/userId_Autocomplete_ID"/>