当前位置: 首页>>代码示例>>Java>>正文


Java SearchView.setIconifiedByDefault方法代码示例

本文整理汇总了Java中android.widget.SearchView.setIconifiedByDefault方法的典型用法代码示例。如果您正苦于以下问题:Java SearchView.setIconifiedByDefault方法的具体用法?Java SearchView.setIconifiedByDefault怎么用?Java SearchView.setIconifiedByDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.SearchView的用法示例。


在下文中一共展示了SearchView.setIconifiedByDefault方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateOptionsMenu

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_main, menu);

    // Get the SearchView and set the searchable configuration
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
    // Assumes current activity is the searchable activity
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setIconifiedByDefault(true); // Do not iconify the widget; expand it by default

    searchView.setQueryHint(getResources().getString(R.string.search_hint));

    return true;
}
 
开发者ID:JamesJose7,项目名称:GithubProject,代码行数:18,代码来源:MainActivity.java

示例2: onCreateOptionsMenu

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    // Associate searchable configuration with the SearchView
    SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()));
    searchView.setIconifiedByDefault(false);

    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            model.search(query);
            return true;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            return true;
        }
    });
}
 
开发者ID:dream83619,项目名称:GoogleBookReader-android,代码行数:24,代码来源:BookListFragment.java

示例3: onCreateOptionsMenu

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_search, menu);

    SearchManager mSearchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView mSearchView = (SearchView) menu.findItem(R.id.action_search).getActionView();

    mSearchView.setSearchableInfo(mSearchManager.getSearchableInfo(getComponentName()));
    mSearchView.setIconifiedByDefault(true);
    mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
       @Override
       public boolean onQueryTextSubmit(String query) {
           mAdapter.getFilter().filter(query);
           return false;
       }

       @Override
       public boolean onQueryTextChange(String newText) {
           mAdapter.getFilter().filter(newText);
           return false;
       }
    });

    return true;
}
 
开发者ID:MrDoomy,项目名称:OverFlow,代码行数:26,代码来源:ContactActivity.java

示例4: 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

示例5: 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

示例6: onCreateOptionsMenu

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
  MenuInflater inflater = getMenuInflater();
  inflater.inflate(R.menu.options_menu, menu);
  // Associate searchable configuration with the SearchView
  SearchManager searchManager =
      (SearchManager) getSystemService(Context.SEARCH_SERVICE);
  searchView = (SearchView) menu.findItem(R.id.search).getActionView();
  searchView.setSearchableInfo(
      searchManager.getSearchableInfo(getComponentName()));
  searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default
  searchView.onActionViewExpanded();
  return true;
}
 
开发者ID:charlesng,项目名称:SampleAppArch,代码行数:15,代码来源:ShoppingActivity.java

示例7: onCreate

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.find_user);
    allUsers = new ArrayList<>();
    resultsList = new ArrayList<>();

    resultCount = (TextView) findViewById(R.id.results_found);

    resultsListView = (RecyclerView) findViewById(R.id.search_listview);
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    resultsListView.setLayoutManager(layoutManager);

    RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(this, DividerItemDecoration.VERTICAL);
    resultsListView.addItemDecoration(itemDecoration);

    // Set up Search View
    SearchView searchFriends = (SearchView) findViewById(R.id.user_search);
    searchFriends.setQueryHint("Search for a user");
    searchFriends.setIconifiedByDefault(false);
    searchFriends.setOnQueryTextListener(this);

    // Get all users
    ElasticSearchController.GetAllUsers getUsersTask = new ElasticSearchController.GetAllUsers();
    getUsersTask.execute();

    try {
        ArrayList<UserAccount> tempUsers = getUsersTask.get();
        allUsers.addAll(tempUsers);
    } catch (Exception e) {
        Log.i("HabitUpDEBUG", "Failed to get all users.");
    }

}
 
开发者ID:CMPUT301F17T29,项目名称:HabitUp,代码行数:35,代码来源:FindUserActivity.java

示例8: onCreateOptionsMenu

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.database_opened, menu);
    getMenuInflater().inflate(R.menu.main, menu);
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    searchMenuItem = menu.findItem(R.id.action_search);
    SearchView searchView = (SearchView) searchMenuItem.getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setIconifiedByDefault(false);
    searchView.requestFocusFromTouch();
    return true;
}
 
开发者ID:RyuzakiKK,项目名称:NoteCrypt,代码行数:14,代码来源:MainActivity.java

示例9: onCreateOptionsMenu

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.options_menu, menu);

    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
        SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
        SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
        searchView.setIconifiedByDefault(false);
    }
    
    return true;
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:15,代码来源:WordActivity.java

示例10: onCreateOptionsMenu

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.options_menu, menu);

    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
        SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
        SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
        searchView.setIconifiedByDefault(false);
    }

    return true;
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:15,代码来源:SearchableDictionary.java

示例11: onCreateView

import android.widget.SearchView; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.search_users_groups_layout, container, false);

    // Get the SearchView and set the searchable configuration
    SearchView searchView = (SearchView) view.findViewById(R.id.searchView);
    SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(
            getActivity().getComponentName())   // assumes parent activity is the searchable activity
    );
    searchView.setIconifiedByDefault(false);    // do not iconify the widget; expand it by default

    searchView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI); // avoid fullscreen with softkeyboard

    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            Log_OC.v(TAG, "onQueryTextSubmit intercepted, query: " + query);
            return true;    // return true to prevent the query is processed to be queried;
            // a user / group will be picked only if selected in the list of suggestions
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            return false;   // let it for the parent listener in the hierarchy / default behaviour
        }
    });

    return view;
}
 
开发者ID:skymania,项目名称:Cirrus,代码行数:36,代码来源:SearchShareesFragment.java

示例12: onCreateOptionsMenu

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
	SearchView searchEditText = new SearchView(this);
	searchEditText.setIconifiedByDefault(true);
	searchEditText.setOnQueryTextListener(this);
	searchEditText.setQueryHint("Search Here");

	menu.add(0, 2, 2, "Search").setActionView(searchEditText).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
	menu.add(1, 0, 0, "New word").setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
	menu.add(2, 1, 1, "Save").setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

	return true;
}
 
开发者ID:nmud,项目名称:nmud,代码行数:14,代码来源:DictionaryActivity.java

示例13: 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);
	MenuItem searchItem = menu.findItem(R.id.action_search);
       mSearchView = (SearchView) searchItem.getActionView();
	mSearchView.setIconifiedByDefault(true);
	mSearchView.setOnQueryTextListener(this);
	return super.onCreateOptionsMenu(menu);

}
 
开发者ID:javadtaghia,项目名称:DeeBrowser,代码行数:13,代码来源:MainActivity.java

示例14: onCreateOptionsMenu

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
	inflater.inflate(R.menu.actionbar_menu_atuserfragment, menu);
	SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE);
	SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
	searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()));
	searchView.setIconifiedByDefault(false);
	searchView.setQueryHint(getString(R.string.at_other));
	searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
		@Override
		public boolean onQueryTextSubmit(String query) {
			return false;
		}

		@Override
		public boolean onQueryTextChange(String newText) {
			if (!TextUtils.isEmpty(newText)) {
				if (task != null) {
					task.cancel(true);
				}
				task = new AtUserTask(newText);
				task.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
			} else {
				if (task != null) {
					task.cancel(true);
				}
				atList.clear();
				result.clear();
				atList = AtUsersDBTask.get(GlobalContext.getInstance().getCurrentAccountId());
				for (AtUserBean b : atList) {
					result.add(b.getNickname());
				}
				adapter.notifyDataSetChanged();
			}
			return false;
		}
	});
	searchView.requestFocus();
}
 
开发者ID:lookwhatlook,项目名称:WeiboWeiBaTong,代码行数:40,代码来源:AtUserFragment.java

示例15: 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


注:本文中的android.widget.SearchView.setIconifiedByDefault方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。