3

I've got trouble with show keyboard when has focus in edittext. i want remove focus at the first time after im showing my screen. Can any pro help me. Tks so much.

0

1 Answer 1

3

Set the properties of the parent layout

android:focusable="true"  
android:focusableInTouchMode="true"

Like this:

<LinearLayout 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@color/black"
    android:gravity="center_horizontal"

    android:focusable="true"  
    android:focusableInTouchMode="true">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/logo"
        android:background="@drawable/dictionary_logo"/>

    <RelativeLayout 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/searchbar_bg"
        android:gravity="center_vertical">

        <EditText
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:id="@+id/et_search"
           android:background="@null"
           android:hint="Search"
           android:singleLine="true"/>

    </RelativeLayout>

</LinearLayout>
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.