searchview

How to keep expanded SearchView on the right side of ActionBar (while using custom icon)?

丶灬走出姿态 提交于 2020-01-20 04:58:04
问题 My question is closely related to SearchView wrong alignment and SearchView positions when expanded in ActionBar but the answers posted there do not work. So, I'm using a SearchView in the Action Bar: <item android:id="@+id/action_search" android:icon="@drawable/navi_search" android:title="@string/action_search" android:showAsAction="ifRoom|collapseActionView" android:actionViewClass="android.widget.SearchView" /> It looks like this by default (top-right corner, next to overflow menu):

How to setQuery from voice search

送分小仙女□ 提交于 2020-01-16 09:44:26
问题 I'm trying to inject the transcribed text in the search query in order to filter my adapter list, but, after trying every combination I could imagine, I come here to ask for help. For instance, if handle the intent after a new intent and set text to a TextView everything works fine and the voice recorder transcribes what is said correctly, but I'm not being able to get the same String and set the SearchView query successfully. The keyboard microphone, otherwise, captures the text and pass it

AppCompat SearchView icon can't be GONE

眉间皱痕 提交于 2020-01-14 04:49:16
问题 I'm using android.support.v7.widget.SearchView and i need to make this search icon GONE. I have custom ActionBar layout with SearchView: <android.support.v7.widget.SearchView android:id="@+id/search" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone"/> initialize SearchView : searchView = (SearchView) findViewById(R.id.search); AutoCompleteTextView searchText = (AutoCompleteTextView) searchView.findViewById(R.id.search_src_text); searchText

AppCompat SearchView icon can't be GONE

给你一囗甜甜゛ 提交于 2020-01-14 04:48:46
问题 I'm using android.support.v7.widget.SearchView and i need to make this search icon GONE. I have custom ActionBar layout with SearchView: <android.support.v7.widget.SearchView android:id="@+id/search" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone"/> initialize SearchView : searchView = (SearchView) findViewById(R.id.search); AutoCompleteTextView searchText = (AutoCompleteTextView) searchView.findViewById(R.id.search_src_text); searchText

How to type text on a SearchView using espresso

こ雲淡風輕ζ 提交于 2020-01-13 19:19:29
问题 TypeText doesn't seem to work with SearchView . onView(withId(R.id.yt_search_box)) .perform(typeText("how is the weather?")); gives the error: Error performing 'type text(how is the weather?)' on view 'with id:../yt_search_box' 回答1: For anyone that bump into this problem too, the solution is to write a ViewAction for the type SearchView, since the typeText only supports TextEditView Here my solution: public static ViewAction typeSearchViewText(final String text){ return new ViewAction(){

How do I pass extra variables during a search invoked by a SearchView/ Widget?

倖福魔咒の 提交于 2020-01-12 06:53:59
问题 I am successfully using a search widget in my action bar to perform a search following this guide. The search is fine, but I'm wondering how to pass additional variables on a search. The same guide states I can override onSearchRequested() , but this doesn't seem to work with a search widget. Override in question: @Override public boolean onSearchRequested() { Bundle appData = new Bundle(); appData.putString("KEY", "VALUE"); startSearch(null, false, appData, false); return true; } Getting the

Margin between SearchView and collapseIcon in toolbar

天涯浪子 提交于 2020-01-11 04:35:08
问题 I'm trying to implement android.support.v7.widget.SearchView with a collapseIcon on the Toolbar . Everything works fine i.e, the SearchView is working as expected but I'm unable to remove/ reduce the padding between the SearchView and collapseIcon , as visible in the attached screenshot. Any ideas on how can I do that? I've tried : app:contentInsetStartWithNavigation="0dp" app:contentInsetLeft="0dp" app:contentInsetStart="0dp" android:contentInsetLeft="0dp" android:contentInsetStart="0dp" but

Sherlock actionbar unable to find class

我的梦境 提交于 2020-01-06 12:43:59
问题 I am implementing searchview with sherlock actionbar by refering https://stackoverflow.com/a/14085524/992665 but when I run the application I get the error as could not find the class SuggestionsAdapter. My log 12-30 13:13:39.929: E/dalvikvm(7286): Could not find class 'com.actionbarsherlock.widget.SuggestionsAdapter', referenced from method com.actionbarsherlock.widget.SearchView.updateSearchAutoComplete 12-30 13:13:39.932: E/dalvikvm(7286): Could not find class 'com.actionbarsherlock.widget

Get the contacts list from phone and display it using RecyclerView and implement SearchView functionality to search

泪湿孤枕 提交于 2020-01-03 06:46:09
问题 In this I am able to get the details of my contacts. But not using RecyclerView. It is using ListView. It is using SimpleCursorAdapter. I don't know how to use SimpleCursorAdapter in RecyclerView. I know how to use RecyclerView with constants String to display. But in this I want to retrieve data using Contacts DB. Please Help me I am new to android. I don't know how to implement this. Thanks in advance public class MainActivity extends AppCompatActivity { SimpleCursorAdapter mAdapter;

How to display searchview close icon when expanded in android?

大憨熊 提交于 2020-01-03 03:44:08
问题 I have an imageView. When i click image, i am hidding image and enabling searchview in expanded. But problem is close icon is not visible. How to make close icon visible when searchview in expanded form? Here is my piece of code: public class HomeActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); search = (SearchView) findViewById(R.id.search); searchImage=(ImageView)