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.
Asked
Active
Viewed 3,110 times
1 Answers
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>

iRuoBin
- 123
- 1
- 8