本文整理匯總了Java中android.support.v4.view.MenuItemCompat.collapseActionView方法的典型用法代碼示例。如果您正苦於以下問題:Java MenuItemCompat.collapseActionView方法的具體用法?Java MenuItemCompat.collapseActionView怎麽用?Java MenuItemCompat.collapseActionView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v4.view.MenuItemCompat
的用法示例。
在下文中一共展示了MenuItemCompat.collapseActionView方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: clearSearchView
import android.support.v4.view.MenuItemCompat; //導入方法依賴的package包/類
private void clearSearchView() {
if (searchView != null && itemSearch != null) {
if (searchView.getQuery().length() > 0) {
searchView.setQuery("", false);
}
MenuItemCompat.collapseActionView(itemSearch);
}
itemsFilter = "";
}
示例2: handleSearchIntent
import android.support.v4.view.MenuItemCompat; //導入方法依賴的package包/類
private void handleSearchIntent(Intent intent) {
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
String query = intent.getStringExtra(SearchManager.QUERY);
if (query != null && !query.isEmpty()) {
MenuItemCompat.collapseActionView(menuSearch);
AsyncTaskCompat.executeParallel(new SearchTask(), query);
}
}
}
示例3: onCreateOptionsMenu
import android.support.v4.view.MenuItemCompat; //導入方法依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_search, menu);
MenuItem searchItem = menu.findItem(R.id.action_search);
SearchView searchView =
(SearchView) MenuItemCompat.getActionView(searchItem);
searchView.setOnQueryTextListener(this);
searchView.setInputType(InputType.TYPE_TEXT_FLAG_CAP_WORDS);
searchView.setQuery(mPresenter.getSearchModels().get(0).getQuery(), false);
if (isInputMode) {
MenuItemCompat.expandActionView(searchItem);
} else {
MenuItemCompat.collapseActionView(searchItem);
}
MenuItemCompat.setOnActionExpandListener(searchItem, this);
AutoCompleteTextView autoCompleteTextView = searchView
.findViewById(android.support.v7.appcompat.R.id.search_src_text);
autoCompleteTextView.setThreshold(0);
autoCompleteTextView.setAdapter(new ArrayAdapter<>(this,
R.layout.layout_item_simple_list, mPresenter.getSearchRecordList()));
autoCompleteTextView.setDropDownBackgroundDrawable(new ColorDrawable(ViewUtils.getWindowBackground(getActivity())));
autoCompleteTextView.setOnItemClickListener((parent, view, position, id) -> {
onQueryTextSubmit(parent.getAdapter().getItem(position).toString());
});
return super.onCreateOptionsMenu(menu);
}
示例4: onPreExecute
import android.support.v4.view.MenuItemCompat; //導入方法依賴的package包/類
@Override
protected void onPreExecute() {
super.onPreExecute();
if (mSearchView != null) {
mSearchView.setIconified(true);
MenuItemCompat.collapseActionView(mSearchViewMenuItem);
mSearchView.setQuery("", false);
}
}
示例5: hideSeachView
import android.support.v4.view.MenuItemCompat; //導入方法依賴的package包/類
public void hideSeachView() {
if(mSearchItem!=null)
MenuItemCompat.collapseActionView(mSearchItem);
}