需要在外层布局加入
android:focusable="true"
android:focusableInTouchMode="true"
例
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white_tran"
android:focusable="true"
android:focusableInTouchMode="true"
tools:context="icbc.com.musiccut.activity.SearchActivity">
...
<android.support.v7.widget.AppCompatEditText
android:id="@+id/mEtSearch"
android:layout_width="0dp"
android:layout_height="32dp"
android:layout_marginRight="8dp"
android:background="@drawable/search_bg"
android:hint="音乐关键字"
android:paddingBottom="5dp"
android:paddingLeft="8dp"
android:paddingTop="5dp"
android:textColorHint="@color/gray_deep"
android:textSize="@dimen/title_size"
app:layout_constraintBottom_toBottomOf="@id/mTvBack"
app:layout_constraintLeft_toRightOf="@id/mTvBack"
app:layout_constraintRight_toLeftOf="@id/mBtnScan"
app:layout_constraintTop_toTopOf="@id/mTvBack" />
...
</android.support.constraint.ConstraintLayout>

1488

被折叠的 条评论
为什么被折叠?



