Android how to make EditText not automatically get focus

EditText automatically gets the focus, the soft keyboard pops up automatically

Setting focuseable='false' also doesn't fundamentally solve the problem

Make the EditText focus still exist but not automatically get it

 

It can be solved by setting the parent control of EditText

<RelativeLayout
android:id="@+id/ll_comments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:background="#F0F0F0"
android:orientation="horizontal">

    <Button
android:id="@+id/btn_submit"
android:layout_width="80dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/background_button_gray"
android:gravity="center"
android:text="Submit" />

    <EditText
android:id="@+id/et_comments"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:layout_toLeftOf="@+id/btn_submit"
android:background="@drawable/search_input"
android:hint="Add comment"
android:paddingLeft="10dp"
android:singleLine="true" />


</RelativeLayout>

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326992644&siteId=291194637