@Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); final MenuItem menuItem = menu.findItem(FragmentsCommons.SEARCH_FILTER_OPTION_MENU_ID); menuItem.setIcon(R.drawable.ccc_search_icon_withe); final SearchView searchView = (SearchView) menuItem.getActionView(); SearchViewStyleHelper.on(searchView) .setCursorColor(Color.WHITE) .setTextColor(Color.WHITE) .setHintTextColor(Color.WHITE) .setSearchHintDrawable(R.drawable.ccc_search_icon_withe) .setSearchButtonImageResource(R.drawable.ccc_search_icon_withe) .setCloseBtnImageResource(R.drawable.ccc_close_icon_white) .setSearchPlateTint(Color.WHITE) .setSubmitAreaTint(Color.WHITE); searchView.setQueryHint("Search..."); searchView.setOnQueryTextListener( new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { List<CryptoCustomerCommunityInformation> filteredList = filterList(newText, cryptoCustomerCommunityInformationList); adapter.changeDataSet(filteredList); return true; } }); }
@Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); final MenuItem menuItem = menu.findItem(1); if (menuItem != null) { menuItem.setIcon(R.drawable.search_icon); final android.widget.SearchView searchView = (android.widget.SearchView) menuItem.getActionView(); SearchViewStyleHelper.on(searchView) .setCursorColor(Color.WHITE) .setTextColor(Color.WHITE) .setHintTextColor(Color.WHITE) .setSearchHintDrawable(R.drawable.search_icon) .setSearchButtonImageResource(R.drawable.search_icon) .setCloseBtnImageResource(R.drawable.search_icon) .setSearchPlateTint(Color.WHITE) .setSubmitAreaTint(Color.WHITE); searchView.setQueryHint("Search..."); searchView.setOnQueryTextListener( new android.widget.SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { List<IntraUserInformation> filteredList = filterList(newText, lstIntraUserInformations); adapter.changeDataSet(filteredList); return true; } }); } else { Log.e(TAG, "SearchView null, please check this"); } }