當前位置: 首頁>>代碼示例>>Java>>正文


Java SearchView.setSubmitButtonEnabled方法代碼示例

本文整理匯總了Java中android.widget.SearchView.setSubmitButtonEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java SearchView.setSubmitButtonEnabled方法的具體用法?Java SearchView.setSubmitButtonEnabled怎麽用?Java SearchView.setSubmitButtonEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.SearchView的用法示例。


在下文中一共展示了SearchView.setSubmitButtonEnabled方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreateOptionsMenu

import android.widget.SearchView; //導入方法依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.main, menu);

    searchItem = menu.findItem(R.id.search);
    searchView = (SearchView) searchItem.getActionView();

    if (searchView != null)
    {
        searchView.setSubmitButtonEnabled(true);
        searchView.setImeOptions(EditorInfo.IME_ACTION_GO);
        searchView.setOnQueryTextListener(new QueryTextListener());
    }

    return true;
}
 
開發者ID:billthefarmer,項目名稱:editor,代碼行數:19,代碼來源:Editor.java

示例2: onCreateOptionsMenu

import android.widget.SearchView; //導入方法依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
	// Inflate the menu items for use in the action bar
	MenuInflater inflater = getMenuInflater();
	inflater.inflate(R.menu.main_activity_actions, menu);

	// Get the SearchView and set the searchable configuration
	SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
	SearchView searchView = (SearchView) menu.findItem(R.id.action_search)
			.getActionView();

	searchView.setSearchableInfo(searchManager
			.getSearchableInfo(new ComponentName(this,
					ChannelSearchActivity.class)));
	searchView.setIconifiedByDefault(false);
	searchView.setSubmitButtonEnabled(true);

	return super.onCreateOptionsMenu(menu);
}
 
開發者ID:guglielmino,項目名稱:pushetta-android-app,代碼行數:20,代碼來源:MainActivity.java

示例3: onCreateOptionsMenu

import android.widget.SearchView; //導入方法依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu){

    MenuInflater inflater = getMenuInflater();
    inflater.inflate (R.menu.options_menu, menu);

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    MenuItem searchItem = menu.findItem(R.id.search_bar);

    SearchView searchView = (SearchView) searchItem.getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setIconifiedByDefault(false);
    searchView.setSubmitButtonEnabled(false);
    searchView.setOnQueryTextListener(this);

    return super.onCreateOptionsMenu(menu);
}
 
開發者ID:Shaderboy,項目名稱:V-Scan,代碼行數:18,代碼來源:Lookup.java

示例4: onCreateOptionsMenu

import android.widget.SearchView; //導入方法依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
  MenuInflater menuInflater = getMenuInflater();
  menuInflater.inflate(R.menu.search_activity, menu);

  searchView =
      (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.search));
  searchView.setSubmitButtonEnabled(true);
  searchView.setIconified(false);
  searchView.setOnQueryTextListener(this);

  return true;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:FlickrSearchActivity.java

示例5: onCreateOptionsMenu

import android.widget.SearchView; //導入方法依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
  MenuInflater menuInflater = getMenuInflater();
  menuInflater.inflate(R.menu.search_activity, menu);

  searchView = (SearchView) menu.findItem(R.id.search).getActionView();
  searchView.setSubmitButtonEnabled(true);
  searchView.setIconified(false);
  searchView.setOnQueryTextListener(this);

  return true;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:FlickrSearchActivity.java

示例6: onCreateOptionsMenu

import android.widget.SearchView; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    MenuItem searchMenuItem = menu.findItem(R.id.action_search);
    MenuItem importItem = menu.findItem(R.id.action_import);
    importItem.setVisible(true);
    SearchView searchView = (SearchView) searchMenuItem.getActionView();
    searchView.setQueryHint(getString(R.string.search));
    searchView.onActionViewExpanded();
    searchView.clearFocus();
    searchView.setSubmitButtonEnabled(false);
    searchView.setQueryRefinementEnabled(false);
    searchView.setOnQueryTextListener(this);
}
 
開發者ID:jboss-outreach,項目名稱:lead-management-android,代碼行數:15,代碼來源:ContactsFragment.java

示例7: onCreateOptionsMenu

import android.widget.SearchView; //導入方法依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
	getMenuInflater().inflate(R.menu.actionbar_menu_searchmainactivity, menu);
	final SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
	final SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
	searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
	searchView.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
	searchView.setIconifiedByDefault(false);
	searchView.setSubmitButtonEnabled(false);
	searchView.requestFocus();
	return super.onCreateOptionsMenu(menu);

}
 
開發者ID:lookwhatlook,項目名稱:WeiboWeiBaTong,代碼行數:14,代碼來源:SearchMainActivity.java

示例8: onCreateOptionsMenu

import android.widget.SearchView; //導入方法依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_idols, menu);

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    searchView.setSubmitButtonEnabled(true);
    searchView.setOnQueryTextListener(this);

    return true;
}
 
開發者ID:MagiCircles,項目名稱:Sukutomo-Android,代碼行數:15,代碼來源:IdolsSearchActivity.java

示例9: onCreateView

import android.widget.SearchView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {

    //inflate the search view
    View v = inflater.inflate(R.layout.search_layout, container, false);

    //get a reference to the spinner
    final Spinner spinner = (Spinner) v.findViewById(R.id.spinner);

    //add all the categories to the spinner
    ArrayList<String> al = new ArrayList<>();
    al.add("All");

    if (MainActivity.categoryList != null) {
        al.addAll(Arrays.asList(MainActivity.categoryList));
    }

    //create an array adapter and add it to the spinner
    ArrayAdapter<String> aa = new ArrayAdapter<>(v.getContext(), R.layout.spinner_dropdown, al);
    spinner.setAdapter(aa);

    //associate a query listener to the search view
    SearchView sv = (SearchView) v.findViewById(R.id.searchView);
    sv.setSubmitButtonEnabled(true);
    sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {

            Bundle bundle = new Bundle();

            //detect the selected category
            String selected = spinner.getSelectedItem().toString();

            //if not "All", a filter is passed to the list fragment
            if (!selected.equals("All")) {

                int position = Arrays.asList(MainActivity.categoryList).indexOf(selected);

                bundle.putInt("category_id", MainActivity.categoryIDs[position]);
            }

            bundle.putString("q", query);

            //create a new list fragment, pass the filters to it, and load it
            Fragment newFragment = new ListFragment();
            newFragment.setArguments(bundle);
            getFragmentManager()
                    .beginTransaction()
                    .replace(R.id.frame, newFragment)
                    .commit();

            return true;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            return false;
        }
    });

    return v;
}
 
開發者ID:Marketcloud,項目名稱:marketcloud-sample-android-application,代碼行數:63,代碼來源:SearchFragment.java


注:本文中的android.widget.SearchView.setSubmitButtonEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。