在EditText的父控件加上这两个属性。
android:focusable="true"
android:focusableInTouchMode="true"
就可以了。
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/corners_white"
android:gravity="center_vertical"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/search_bar_search_icon_margin"
android:src="@drawable/search" />
<EditText
android:id="@+id/view_search_et"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:hint="@string/search"
android:imeOptions="actionSearch"
android:singleLine="true" />
</LinearLayout>