网站上的图文介绍怎么做,微信投票网站开发,wordpress 地图导航,wordpress 拖动效果图这个app结构和我之前将记事本开发的博客基本一致#xff0c;我这里直接讲一下怎样添加使用的开发软件为android studio首先在res目录下新建文件夹menu#xff0c;添加目录布局文件main_menu之后在main_menu中添加如下代码xmlns:apphttp://schemas.android.com/ap…效果图这个app结构和我之前将记事本开发的博客基本一致我这里直接讲一下怎样添加使用的开发软件为android studio首先在res目录下新建文件夹menu添加目录布局文件main_menu之后在main_menu中添加如下代码xmlns:apphttp://schemas.android.com/apk/res-autoandroid:idid/searchandroid:icondrawable/ic_search_black_24dp/这里设置图标可以自由选择我是在drawable下添加了放大镜的图标并在此引用android:titleSearchapp:actionViewClassandroid.widget.SearchViewapp:showAsActionalways之后在Mainactivity中重写onCreateOptionsMenu(Menu menu)函数监听等功能都在此实现public booleanonCreateOptionsMenu(Menu menu){getMenuInflater().inflate(R.menu.main_menu,menu);MenuItem searchmenu.findItem(R.id.search);SearchView mysearchview(SearchView)search.getActionView();mysearchview.setQueryHint(搜索);mysearchview.setOnQueryTextListener(newSearchView.OnQueryTextListener(){Override//当提交搜索框内容后执行的方法public booleanonQueryTextSubmit(String query) {return false;}Override//当搜索框内内容改变时执行的方法public booleanonQueryTextChange(String newText) {refresh(newText);//数据更新函数newText为获取到的搜索框中内容return false;}});return super.onCreateOptionsMenu(menu);}更新函数voidrefresh(String key){SimpleAdapter adapter new SimpleAdapter(this,MainActivity.this.mytable.getdata(key), R.layout.list,new String[]{id,text,time},new int[]{R.id.id,R.id.text,R.id.time});ListView listView(ListView)findViewById(R.id.vi);listView.setAdapter(adapter);}这里附上数据库操作类中getdata()方法public Listgetdata(String key){Listlistnew ArrayList();Map mapnew HashMap();String sqlSELECT id,text,time FROM TABLENAME WHERE text LIKE ‘%key%‘ OR time LIKE ‘%key%‘;Cursor resultthis.db.rawQuery(sql,null);for(result.moveToFirst();!result.isAfterLast();result.moveToNext()){mapnew HashMap();map.put(id,result.getInt(0));map.put(text,result.getString(1));map.put(time,result.getString(2));list.add(map);}return list;}讲得比较笼统具体的文件结构还请参照我之前的随笔https://www.cnblogs.com/liuleliu/p/12230819.html原文https://www.cnblogs.com/liuleliu/p/12256918.html