取消EditText默认行为
在android中,进入一个页面后 EditText就会默认自动获取焦点。
取消方法:
在EditText的父级控件中设置:
android:focusable="true" android:focusableInTouchMode="true"
如:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true">
<EditText
android:id="@+id/editext"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>