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


Java SearchView.setIconified方法代码示例

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


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

示例1: onCreateOptionsMenu

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

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

    if (searchItem != null) {
        mSearchView = (SearchView) searchItem.getActionView();
    }

    if (mSearchView != null) {
        mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
        mSearchView.setIconified(false);
        mSearchView.setQueryHint(getString(R.string.search_view_hint));
        mSearchView.setMaxWidth(getResources().getDimensionPixelOffset(R.dimen.BU_22));
    }
    setListenerForSearchView();
    return super.onCreateOptionsMenu(menu);
}
 
开发者ID:paladin952,项目名称:Movie-Time-Spent,代码行数:22,代码来源:MainActivity.java

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

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

示例4: initView

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
protected void initView() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    mActionBar = getSupportActionBar();
    if(mActionBar!=null) mActionBar.setDisplayHomeAsUpEnabled(false);
    mActionBar.setTitle("");
    mSearch = (SearchView) findViewById(R.id.search_view);
    mSearch.setIconified(false);
    mSearch.clearFocus();
}
 
开发者ID:JoeSteven,项目名称:Zatuji,代码行数:12,代码来源:SearchingActivity.java

示例5: onBackPressed

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
    SearchView searchView = (SearchView) findViewById(R.id.search);
    if (!searchView.isIconified()) {
        searchView.setIconified(true);
    } else {
        super.onBackPressed();
    }
}
 
开发者ID:harrij15,项目名称:SquareMeals,代码行数:10,代码来源:HomepageActivity.java

示例6: onOptionsItemSelected

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    if (id == R.id.action_preferences) {
        Intent prefIntent = new Intent(HomepageGuestActivity.this, MyDietActivity.class);

        startActivity(prefIntent);
        return true;
    }

    if (id == R.id.search) {
        SearchView searchView = (SearchView) item.getActionView();
        //searchView.dispatchSetActivated();
        // TODO - Remove unnecessary function calls
        searchView.dispatchSetActivated(true);
        searchView.setPressed(true);
        searchView.setSelected(true);
        searchView.setEnabled(true);
        searchView.setFocusable(true);
        searchView.setIconified(false);
        searchView.requestFocusFromTouch();
        return true;
    }

    return true;

}
 
开发者ID:harrij15,项目名称:SquareMeals,代码行数:32,代码来源:HomepageGuestActivity.java

示例7: onPrepareOptionsMenu

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public void onPrepareOptionsMenu(Menu menu) {
    final MenuItem searchItem = menu.findItem(R.id.action_lookup);

    searchView = (SearchView)searchItem.getActionView();
    searchView.setOnQueryTextListener(this);

    if(openSearch){
        searchView.setIconified(false);
        searchView.setQuery(textQuery,false);
        searchView.requestFocus();
    }
}
 
开发者ID:duniter,项目名称:duniter-android-app,代码行数:14,代码来源:IdentityListFragment.java

示例8: 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.
    getMenuInflater().inflate(R.menu.menu_search, menu);
    final MenuItem searchItem = menu.findItem(R.id.search_view);
    mSearchView = (SearchView) searchItem.getActionView();
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    mSearchView.setIconified(false);
    mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String query) {
            SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
            sharedPreferences.edit().putString(USER_QUERY, query).apply();
            mSearchView.clearFocus();
            finish();
            return true;
        }

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

    mSearchView.setOnCloseListener(new SearchView.OnCloseListener() {
        @Override
        public boolean onClose() {
            finish();
            return false;
        }
    });

    return true;
}
 
开发者ID:gusar,项目名称:ditandroid,代码行数:37,代码来源:SearchActivity.java

示例9: makeSearchMenuEntry

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
public MenuItem makeSearchMenuEntry(Menu menu) {
  MenuItem item = menu.add("Search");
  searchView = new SearchView(diskusage);
  origSearchBackground = searchView.getBackground();
  item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
  item.setIcon(android.R.drawable.ic_search_category_default);
  item.setActionView(searchView);
  if (searchPattern != null) {
    searchView.setIconified(false);
    searchView.setQuery(searchPattern, false);
  }
  searchView.setOnCloseListener(new OnCloseListener() {
    @Override
    public boolean onClose() {
      Log.d("diskusage", "search closed");
      searchPattern = null;
      diskusage.applyPatternNewRoot(masterRoot, null);
      return false;
    }
  });
  searchView.setOnQueryTextListener(new OnQueryTextListener() {
    @Override
    public boolean onQueryTextSubmit(String query) {
      onQueryTextChange(query);
      return false;
    }

    @Override
    public boolean onQueryTextChange(String newText) {
      Log.d("diskusage", "search query changed to: " + newText);
      searchPattern = newText;
      applyPattern(searchPattern);
      return true;
    }
  });
  return item;
}
 
开发者ID:IvanVolosyuk,项目名称:diskusage,代码行数:39,代码来源:DiskUsageMenuHoneycomb.java

示例10: onCreateOptionsMenu

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

        @Override
        public boolean onQueryTextChange(String newText) {
            networkRecyclerAdapter.getFilter().filter(newText);
            return true;
        }
    });
    // Recreate the last search if the screen was rotated
    if(last_filter_term != null && last_filter_term.length() > 0){
        searchView.setQuery(last_filter_term, true);
        searchView.setIconified(false);
        searchView.clearFocus();
    }
}
 
开发者ID:WIStudent,项目名称:FreifunkAutoConnectApp,代码行数:28,代码来源:AddRemoveNetworksFragment.java

示例11: onCreateOptionsMenu

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

    final MenuItem searchItem = menu.findItem(R.id.action_search);
    searchView = (SearchView) searchItem.getActionView();
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            onQueryTextChange(query);
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            typesAdapter.getFilter().filter(newText);
            filterConstraint = newText;
            return true;
        }
    });
    if (!showingTypes) {
        searchView.setVisibility(View.GONE);
    }
    if (showingTypes && !StringUtils.isEmpty(filterConstraint)) {
        searchView.setIconified(false);
        searchView.setQuery(filterConstraint, true);
    }
    return true;
}
 
开发者ID:jawg,项目名称:osm-contributor,代码行数:30,代码来源:TypeListActivity.java

示例12: onCreate

import android.widget.SearchView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	// TODO Auto-generated method stub
	super.onCreate(savedInstanceState);
	setContentView(R.layout.searchfriends);
	
	mSearchView = (SearchView) findViewById(R.id.searchView1);
	mSearchView.setIconifiedByDefault(true);
	mSearchView.setQueryHint("按姓名或电子邮件搜索");
	mSearchView.setIconified(false);
	mSearchView.setFocusable(false);
	mSearchView.clearFocus();
	mSearchView.requestFocus();
	mSearchView.setOnQueryTextListener(this);
	
 
	mSearchView.setOnFocusChangeListener(new OnFocusChangeListener() {
		
	 
		@Override
		public void onFocusChange(View v, boolean hasFocus) {
			// TODO Auto-generated method stub
			Log.i(MainActivity.TAG, "onfocus2---");
			if(hasFocus){
				Log.i(MainActivity.TAG, "onfocus---");
			}else{
				Log.i(MainActivity.TAG, "lost focus---");
			}
		}
	});
	
	
	mlv = (ListView) findViewById(R.id.search_list);
	
	
	mSearchText = (TextView) findViewById(R.id.searchText);
	mSearchText.setOnClickListener(this);
	
	
	
	myRunner =  BmobUser.getCurrentUser(RunUser.class);
	 
}
 
开发者ID:huazifoothole,项目名称:NikiRun,代码行数:44,代码来源:SearchFriends.java


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