这是我正在做的事情:
@OverrIDepublic voID onCreateOptionsMenu(final Menu menu,MenuInflater inflater) { getSherlockActivity().getSupportMenuInflater().inflate(R.menu.places_menu,menu); SearchManager searchManager = (SearchManager) getSherlockActivity().getSystemService(Context.SEARCH_SERVICE); final SearchVIEw searchVIEw = (SearchVIEw) menu.findItem(R.ID.item_menu_search).getActionVIEw(); SearchVIEw.OnqueryTextListener queryTextListener = new SearchVIEw.OnqueryTextListener() { public boolean onqueryTextChange(String newText) { // this is your adapter that will be filtered mAdapter.getFilter().filter(newText); return true; } public boolean onqueryTextsubmit(String query) { // this is your adapter that will be filtered mAdapter.getFilter().filter(query); return true; } }; if (null != searchVIEw ) { searchVIEw.setSearchableInfo(searchManager.getSearchableInfo(getSherlockActivity().getComponentname())); searchVIEw.setIconifIEdByDefault(false); searchVIEw.setonqueryTextListener(queryTextListener); // CLOSE SEARCH WHEN SOFT KEYBOARD disSMISSES searchVIEw.setonqueryTextFocuschangelistener(new VIEw.OnFocuschangelistener() { @OverrIDe public voID onFocusChange(VIEw vIEw,boolean queryTextFocused) { if(!queryTextFocused) { menu.findItem(R.ID.item_menu_search).collapseActionVIEw(); searchVIEw.setquery("",false); } } }); } super.onCreateOptionsMenu(menu,inflater);}解决方法 通过使用徽标调用setIcon()似乎是可能的.
Actionbar actionbar = getActionbar();actionbar.setlogo(R.drawable.ab_logo);actionbar.setIcon(R.drawable.ab_logo);总结
以上是内存溢出为你收集整理的android – 如何在Sherlock动作栏中更改searchview的dismiss(home)按钮?全部内容,希望文章能够帮你解决android – 如何在Sherlock动作栏中更改searchview的dismiss(home)按钮?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)