目标效果:
在输入框中输入想要查询的关键字,点击查询可以搜索包含该关键字的成语,并且显示列表依然可以进行收藏,查看成语详细信息。
1.新建SearchActivity.java页面和activity_search.xml页面,activity_search.xml页面放置查询输入框和点击按钮和显示集合。
activity_search.xml页面:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_ling"
android:orientation="vertical"
android:padding="10dp"
tools:context=".SearchActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="@+id/etSearch"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3" />
<Button
android:id="@+id/btnSearch"
android:layout_width="0