searchview

Android SearchView - Move icon to right (without ActionBar)

故事扮演 提交于 2019-12-10 13:29:25
问题 I have an android SearchView like so - <SearchView android:layout_width="match_parent" android:layout_height="wrap_content" android:queryHint="Search the forum ..." android:iconifiedByDefault="true" android:id="@+id/search_forum" android:layout_alignParentRight="true" android:textColor="#aaa" /> This is not in my ActionBar, it's somewhere else in my activity. I need the icon (the search icon) to stay on the right of my layout. On click it should expand into the SearchView (same behaviour as

android custom searchView rounded corners

会有一股神秘感。 提交于 2019-12-10 13:27:23
问题 I want to create an Activity with a SearchView that is not in the ActionBar (in fact, I'm using the NoActionBar theme). Now I want this SearchView to have rounded corners (not the EditText inside the actual SearchView, but the SearchView itself), like this: Mockup All I can manage is this: actual SearchView. Can somebody hint me to what I have to change? XML of the Activity: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android

How to remove space on the left side of Android searchview (which is not part of actionbar)?

谁说胖子不能爱 提交于 2019-12-10 12:54:51
问题 I am using a searchview in android app ( searchview is not a part of action bar ). I want to remove the space on the left side of the search icon/ searchview. I searched a lot and received answers which worked for searchviews which are part of action bar. I tried using android:layout_gravity, android:gravity , but they didnt seem to work. I thought of using android:contentInsetStart, android:contentInsetLeft , but these options are not available for searchview (which is not a part of action

Left space in Toolbar with SearchView android studio

陌路散爱 提交于 2019-12-10 12:36:29
问题 I'm trying to add a simple SearchView to the toolbar in my app. Everything it's working fine expect for the layout. There is this "space" between the NavigationDrawer icon and the SearchView . If I set a title the space is filled with that string, otherwise is empty. Empty string: With a string in title: How do I remove that annoying empty space? Edit: I'm using as base code the NavigationDrawer example from Android Studio main.xml <menu xmlns:android="http://schemas.android.com/apk/res

Android: getSearchableInfo(getComponentName()) returning null?

依然范特西╮ 提交于 2019-12-10 12:35:30
问题 I'm trying to get suggestions for SearchView. I've implemented a custom content provider for it. I've also referred to this link to implement suggestions for the SearchView. The problem I'm facing is, I get null value on searchManager.getSearchableInfo(getComponentName()) Here are the snippets: AndroidManifest.xml <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <provider android:name=".SearchProvider" android:enabled="true"

Reusing Action Bar in all activities of application

十年热恋 提交于 2019-12-10 09:42:47
问题 I have created a MenuActivity which is having an Action Bar and an Split Action Bar. I want to use this actionbar and splitactionbar view for all activities in my application. I am a newbie to android so can somebody guide me stepwise about this. Also I am trying to put the search icon on actionbar which is right now appearing on SplitActionBar. I have four icons on SplitActionBar and i want to show search icon on the actionbar not on the SplitActionBar. The search icon is a SearchView item

android - collapse searchview after submit

给你一囗甜甜゛ 提交于 2019-12-10 01:59:18
问题 I am using searchview in my application ( without action bar). How can i collapse searchview after query text submit ? I have these listeners ; @Override public boolean onQueryTextSubmit(String query) { InputMethodManager imm = (InputMethodManager)thisFr.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(globalSearch.getWindowToken(), 0); return false; } @Override public boolean onQueryTextChange(String newText) { // TODO Auto-generated method stub return false; } I

android.support.v4.widget.SearchViewCompat example?

[亡魂溺海] 提交于 2019-12-10 01:06:56
问题 I am trying to use SearchViewCompat with ActionBarSherlock in an API 8 app. public boolean onCreateOptionsMenu(Menu menu) { MenuItem item = menu.add("Search") .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search) .setActionView(R.layout.collapsible_edittext); item.setShowAsAction( MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); // To use SearchViewCompat, I need to add it to the Menu item as well: View searchView = SearchViewCompat

Custom SearchView whole clickable in android

烂漫一生 提交于 2019-12-10 00:51:08
问题 I have a SearchView widget in my app, and I want to ask some questions about making it custom. First of all, you can start search only by clicking on search icon, is there any way to make whole SearchView clickable? Also, is there a way to make SearchView appear something like this when it is clicked? It is now in this state: Here is my code: citySearch = (SearchView) findViewById(R.id.city_search_bar); citySearch.setBackgroundResource(R.drawable.search_background); citySearch

How to hide android keyboard in search view

末鹿安然 提交于 2019-12-09 15:12:01
问题 I've used search view in my application. I wonder how to hide the keyboard when i hit the search button on the search view? I have to use the back button to view the results. 回答1: Here is a similar question: How to dismiss keyboard in Android SearchView? @Override public boolean onQueryTextSubmit(String query) { // Do search. searchView.clearFocus(); return true; } 回答2: Try this code: private void hideKeyboard(){ InputMethodManager inputManager = (InputMethodManager)getSystemService(Context