<?xml version="1.0" encoding="utf-8"?>
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/head"
android:layout_width="match_parent"
android:layout_height="@dimen/head_bar_height"
android:background="@color/main">
<ImageView
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="12dp"
android:src="@mipmap/ic_back" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="信息审计"
android:textColor="@color/white_text"
android:textSize="@dimen/head_bar_text_size" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/white_bg">
<EditText
android:id="@+id/etSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="输入关键字"
android:singleLine="true"
android:maxLength="25"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/black_text"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"/>
<Spinner
android:layout_width="120dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/audit_select"
android:layout_marginRight="6dp"
android:background="@drawable/down"></Spinner>
</LinearLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/audit_srl"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/audit_list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.v4.widget.SwipeRefreshLayout>
在Activity中的一个Fragment
界面很简单就是一个editText和Spinner
下边一个listView
//搜索框
etSearch = (EditText) view.findViewById(R.id.etSearch);
etSearch.addTextChangedListener(new SimTextWatcher() {
@Override
public void onTextChanged(CharSequence charSequence, int start, int before, int count) {
keyWord = charSequence.toString();
search(); //同步按照keyword查找
adapter.notifyDataSetChanged();
}
});
任意输入一个字母,不存在结果的软键盘就自动隐藏了
EditText焦点还在,点击也不再弹出软键盘