Not focus edittext the first time
This question already has an answer here:
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>
链接地址: http://www.djcxy.com/p/24168.html
上一篇: 当项目运行时,EditText自动被选中
下一篇: 第一次没有关注edittext