I have a RecyclerView and below there's an EditText. I want when user taps outside the EditText to close the keyboard.
I searched and find this answer here but it doesn't work for me. User taps outside but EditText still has focus.
My XML code is :
<android.support.v7.widget.RecyclerView
    android:id="@+id/rv_chatroom_messages_list"
    android:paddingBottom="@dimen/spacing_medium"
    android:layout_weight="1"
    android:clickable="true" android:focusableInTouchMode="true" android:focusable="true"
    android:layout_width="match_parent" android:layout_height="0dp"/>
<LinearLayout
    android:orientation="horizontal"
    android:background="@color/white"
    android:layout_marginLeft="@dimen/spacing_large" android:layout_marginBottom="@dimen/spacing_medium"
    android:layout_marginRight="@dimen/spacing_large" android:paddingRight="@dimen/spacing_medium"
    android:layout_width="match_parent" android:layout_height="wrap_content">
    <EditText
        android:id="@+id/et_chatroom_send_message"
        android:layout_gravity="bottom"
        android:background="@null"
        android:textSize="@dimen/app_text_size_normal" android:hint="Type to reply"
        android:layout_marginLeft="@dimen/spacing_large" android:layout_marginRight="@dimen/spacing_large"
        android:layout_weight="1"
        android:layout_width="0dp" android:layout_height="@dimen/spacing_xlarge" android:inputType="textMultiLine" />
    <ImageView
        android:id="@+id/iv_chatroom_send_message_btn"
        android:src="@drawable/ic_pong_2"
        android:layout_gravity="center"
        android:layout_width="48dp" android:layout_height="48dp" android:contentDescription="Send msg button" />
</LinearLayout>
 
     
     
     
    