Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
291 views

Searchview in centre and after focus it goes to app bar in android

Hey guys I am learning Searchview in android. I have searchview in centre and when I focus it will go to app bar just like chrome application. And when focus it will go to app bar I didn't find any ...
Vivek Modi's user avatar
  • 6,969
2 votes
1 answer
1k views

Changing searchView hint text Color [duplicate]

How can I change the searchView hint text color? The hint text color is white, so it's invisible. I want to change the color but I don't know how. This is the searchView Photo And this is the XML code:...
Ghany At-Tirmidzi's user avatar
1 vote
1 answer
410 views

How to customize expanded SearchView inside action bar in Android?

The default SearchView when expanded in the ActionBar looks like this image : I want to customize expanded SearchView similar to this image : I am pretty new in Android Development. I would highly ...
Mayank Lad's user avatar
4 votes
2 answers
5k views

Android Searchview : Open suggestions list dropdown by default

The following code allows to display a small suggestion window in my searchview : I'm searching a way to display this view at the beginning by default when the user click on the search item on the ...
wawanopoulos's user avatar
  • 9,784
0 votes
1 answer
493 views

EditText: keep hint when focused

I have an EditText and I want the hint to stay until the user actually types. By default the hint is already hidden when the user focuses the EditText, before he starts typing. So, how can I keep the ...
me.at.coding's user avatar
  • 17.4k
1 vote
1 answer
29 views

SearchQueryListener returns no results

I have made a news app using ListView and JSON. I want to add search functionality to my app. So IhAave already done displaying my search bar in the action bar. The problem is whenever I click on ...
Sam's user avatar
  • 21
0 votes
1 answer
418 views

Android searchview returns null

I am trying to use a SearchView in my actionbar (for only one fragment) but the SearchView keeps on returning null. fragment import android.os.Bundle import android.view.* import androidx.appcompat....
Jasper's user avatar
  • 2,409
0 votes
2 answers
234 views

How to increase the clickable area of searchview menu icon?

I want to make the entire red circled area (which includes the title, the action bar's background, and the search icon) clickable, but my codes only allows only the search icon clickable. I found the ...
gsk's user avatar
  • 107
0 votes
1 answer
237 views

How to add a SearchView in an ActionBar on NativeScript Android (like WhatsApp)?

I would like to add a SearchView in an ActionBar on NativeScript Android. The same shown in the Material Design Guide and used on WhatsApp when you click on the search icon. Below are examples that ...
bgrand-ch's user avatar
  • 1,218
0 votes
1 answer
422 views

Action bar items are showing in NavigationView and unable to hide 3 dots from action bar

I have NavigationView and search filter on Action bar in same page(Home page), After adding search item on action bar its showing in both action bar and navigation view(menu). And I am unable hide the ...
OhStack's user avatar
  • 116
1 vote
1 answer
1k views

SearchView in expanded mode doesn't hide all action bar icons starting from Marshmallow

SearchView looks fine on Lollipop devices (Android 21): But on Android 23-28 it doesn't hide all icons on the right side: <item android:id="@+id/action_search" android:title="@string/search"...
user924's user avatar
  • 11.9k
1 vote
2 answers
1k views

Nullpointerexception when trying to add SearchView to my appcompat activity

I am getting Nullpointerexception when trying to add SearchView to my appcompat activity.I have already gone through this answer but couldn't resolve it. Here is my menu_main.xml <menu xmlns:...
varmashrivastava's user avatar
4 votes
1 answer
620 views

expandActionView in onCreateOptionsMenu removes or hides other menu items from action bar permanently

I have a searchView in action bar and when user has query in searchView and then rotates the device i set query in searchView in onCreateOptionsMenu and expand searchView with menuItem....
Amani's user avatar
  • 3,949
2 votes
0 answers
331 views

SearchView pushes toolbar item off the edge of the screen

I would like to achieve the following - a SearchView with a button that gets sent to an overflow when the SearchView is expanded: There is a known bug with SearchView that causes it to not respect ...
Matt's user avatar
  • 3,170
1 vote
1 answer
620 views

Keyboard pop up when back from another intent if setIconifiedByDefault is false

Hi guys. When I open Activity 2 from Fragment 1 with intent and press back on Activity 2, my keyboard would pop up automatically if setIconifiedByDefault is false when I create the searchView in ...
Pak Ho Cheung's user avatar
2 votes
1 answer
521 views

Show buttons inside SearchView on onMenuItemActionExpand

I have SearchView on toolbar and i want add time button inside SearchView when expand and hide when collapse. onCreateOptionsMenu @Override public void onCreateOptionsMenu(final Menu menu, final ...
androidXP's user avatar
  • 1,719
5 votes
5 answers
1k views

Search view toolbar close icon

I am using Search view in the toolbar. I am facing issue with the close icon. It is working as excepted on mobile but not working on Android tablets. On the tablet, it is showing in the middle of the ...
Harsh Shah's user avatar
  • 2,322
1 vote
1 answer
635 views

How to prevent ActionBar SearchView button from disappearing

I have been having a lot of trouble trying to fix this one and couldn't find any solutions for this anywhere. Currently I have the following ActionBar option menu <?xml version="1.0" encoding="...
Shadow's user avatar
  • 4,741
0 votes
1 answer
295 views

SearchView in ActionBar with more fragment on android

I need Add SearchBar in ActionBar handle with more Fragments like whatsApp when Search in Tab chats get data and when Search in Tab Status get another data How do This?This is My Code there is 3 tabs ...
Mohamed Mohamed Taha's user avatar
1 vote
1 answer
498 views

Show searchview in actionbar only in parent fragment

I am wondering how to show searchview in actionbar only in parent fragment. For now, when I submit a search from searchview in actionbar and go to next fragment, I still can see the searchview in my ...
Pak Ho Cheung's user avatar
1 vote
1 answer
537 views

searchview cursor color

I have an app with light theme but dark actionbar. So my colorControlActivated is my primary color (green) and with the light background, the edittext cursors are green. The problem is that my ...
Yamila's user avatar
  • 443
0 votes
0 answers
152 views

Android: When keyboard pops up, how to stop MapView and buttons from moving up?

EDIT: When I used to click on searchView, my buttons would appear above the keyboard. Then I was told on stackOverflow to use the following code: android:windowSoftInputMode=“adjustNothing" or ...
iBEK's user avatar
  • 642
1 vote
1 answer
583 views

How to make search Icon and back button icon disappear when clicking on different tab in TabLayout?

When you click on Search icon the searchView and keyboard appear, if the user decides to click on a different tab in TabLayout, I got the searchView and keyboard to disappear but I can't get the "Back"...
iBEK's user avatar
  • 642
1 vote
1 answer
259 views

How to close searchView in onOptionsItemSelected(MenuItem item) when onBackPressed don't work?

Need code to close the searchView when BACK is pressed. So far only have code that closes the keyboard when BACK is pressed. @Override public boolean onOptionsItemSelected(MenuItem item) { int id ...
iBEK's user avatar
  • 642
0 votes
1 answer
116 views

Need to identify correct searchVIew Listener method for button to prepare to close searchView

Need to get the right searchView Listener method to place my code to change my erase typed up search result (round X) button to become a close the searchView entirely white (X) button. Here's my code ...
iBEK's user avatar
  • 642
1 vote
0 answers
149 views

How to set searchView to left side with setTransition or setX?

When I place searchView.setX or searchView.setTranslation it only allows me to use a positive number. Never a negative number. I can't even move the searchView to left with searchView.setX(1/1000) for ...
iBEK's user avatar
  • 642
1 vote
0 answers
571 views

Android Studio, how to set the "x" button in searchView to say "cancel" instead?

So I have a searchView. When I click on the search icon, search view opens, keyboard pops up and the 1st "x" appears so when you type something up you can click "x" to delete what you typed up. That's ...
iBEK's user avatar
  • 642
1 vote
1 answer
446 views

How to move the Search View to left side of screen?

I want my search view to be on left side of screen but can't figure out how to move it. code is in menu_main.xml file shown below. I've looked on StackOverflow and the solutions from the following ...
iBEK's user avatar
  • 642
1 vote
1 answer
195 views

android app search on action bar not getting result

I am making an app for my website. I am working on a single activity i.e. MainActivity. I am not an android developer just learning. The problem is, I have put a search on the actionbar of my ...
user avatar
6 votes
1 answer
3k views

Android Search menu item disappears when pressing back button/collapsing search field

I'm using android SearchView to have a search button in my action bar. I followed this tutorial from Google Developers on YouTube, and added a few tweaks based on my own needs. However, whenever I ...
Magnus E-F's user avatar
-1 votes
2 answers
880 views

How to pass searchview text from action bar to new activity? in android

public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); searchView = (SearchView)menu .findItem(R.id.action_search).getActionView(); ...
Suhas's user avatar
  • 158
1 vote
1 answer
3k views

SearchView with rounded corners in ActionBar

I am working on an app needing a SearchView in the search fragment. I obviously know how to create a classic SearchView, but how is it possible to customize it to get a result like this :
D. Math's user avatar
  • 329
5 votes
1 answer
2k views

How to set the Toolbar collapseIcon color programmatically

I want to change the color of the back button in the toolbar when a search is displayed (the circled white arrow). I managed to change the color of all other elements and I am stuck with the back ...
Guy S's user avatar
  • 1,424
17 votes
10 answers
36k views

How to change searchview icon color?

I know there's already a lot of answers for this question here, and I wouldn't be creating another thread if I hadn't already tried everything I saw here. Anyway, the question is pretty simple. I don'...
Marcus Casagrande's user avatar
1 vote
1 answer
664 views

Force user to enter number in a SearchView

I am using a SearchView on action bar in my app and I defined it as follows <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:...
Cem's user avatar
  • 155
0 votes
1 answer
569 views

Android SearchView searchIcon(magnifying class when collapsed) right padding

I 'm trying to integrate a SearchView, on a custom Toolbar I 'm making. The requirements are: 1) 2 ActionMenuViews 2) Centered Title I have also subclassed SearchView to make it full width, so, ...
mitsest's user avatar
  • 295
0 votes
1 answer
2k views

How to Implement SearchView using volley JSON android?

I am working on a android project where I have to implement search view on the action bar . I am able to parse the JSON data into recycler view using volley. when I try to add a search view, and start ...
Divakar R's user avatar
  • 845
0 votes
1 answer
58 views

Android actionbar behaving strangely

I am trying to create a good looking SearchView. I used this code and integrated it in my DrawerLayout. This is the current XML of my main activity:` <?xml version="1.0" encoding="utf-8"?> <...
user2988879's user avatar
1 vote
1 answer
3k views

Android: how do I get SearchView close button to return the setQueryHint()?

I have a Search icon in my toolbar that searches a RecyclerView list. Pic 1: When the icon is clicked, the toolbar shows the SearchView's setQueryHint " Search here...". Pic 2: When a character ...
AJW's user avatar
  • 1,649
-2 votes
1 answer
199 views

Put a SearchView on the ActionBar [duplicate]

Layout <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http:...
Parteekj's user avatar
3 votes
5 answers
4k views

Searchview in android Toolbar

I am trying to build a searchview in the toolbar ion my android app, but am getting a null pointer exception in the 3rd line of onCreateoptionsMenu method. Any help will be appreciated, thank you in ...
user avatar
3 votes
1 answer
6k views

Android: Add searchView on the Action Bar

My Complete Project Is As Follows: There is a listView connnected to database and a search option with suggestion. I wanna shift this search bar to the action bar and format it just like Google Play ...
DevROYAL's user avatar
-2 votes
1 answer
4k views

How to add Search View on Action bar on one of the fragments in tab layout dynamically?

Please provide me a better solution if you have I am working on android app in which on home Activity by using TabLaout&ViewPager i have added 5 tabs on below Home Social Notice Search Links I ...
Hafiz Muhammad Afzal's user avatar
1 vote
1 answer
276 views

Android: Expanded SearchView aligns right

In my app I want to create a searchview within an actionbar. I've used the following code. <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/...
jennymo's user avatar
  • 1,480
2 votes
0 answers
140 views

How to dynamically set color for back up arrow of search view in Android

In my app, I can dynamically set the color of back up arrow in action bar. But when searchView is expanded, the color of back up arrow changed back to default. I tried to set it back to the correct ...
december's user avatar
2 votes
0 answers
245 views

SearchView in action bar is shifted to right

I added SearchView to my action bar, but it appears to be shifted to right if there is back button (or drawer toggle) in action bar. main_menu.xml: <?xml version="1.0" encoding="utf-8"?> <...
equeim's user avatar
  • 117
4 votes
3 answers
3k views

Android Actionbar SearchView change icon and remove extra spacing

I am implementing SearchView. I have added Search view and all its functionality successfully. Now i want to make it looks great. I need two changes i tried every thing but nothing worked for me : I ...
Mureed Hussain's user avatar
4 votes
5 answers
2k views

Action bar only shows one item next to search view

I want to have a search view and two buttons in the Action Bar. So I created menu/options_menu.xml: <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/...
Nick's user avatar
  • 3,389
0 votes
2 answers
282 views

How to add an android Searchbar1 [duplicate]

I was wondering if anyone could break down for me step by step how to add a searchbar in an activity . I have tried to look it up online but I couldn't really understand how it's done.
Jimmynyc's user avatar
2 votes
0 answers
520 views

Android SearchView clear button misaligned

I have implemented android.support.v7.widget.SearchView in menu.xml and it works good only if I use toolbar instead of action bar. When I use action bar the layout moves the X button of this widget ...
Usman's user avatar
  • 2,391

1
2 3 4 5