So I got this SearchView that has a default space at the bottom for the text inside it. How can I reduce it (see the red lines in picture):
Asked
Active
Viewed 1,019 times
1
-
Try changing padding and/or text gravity – Xjasz Nov 23 '15 at 13:53
-
what theme(s) are you inheriting for your app theme? You might be able to change this in a SearchView style... – kris larson Nov 23 '15 at 16:27
1 Answers
4
Imagine you have
SearchView
named:searchBar
SearchView searchBar = (SearchView) findViewById(R.id.searchViewBar);
Get the view (
AutoCompleteTextView
) that holds the text inside yourSearchView
://The view that contains the SearchView text AutoCompleteTextView searchTextContent = (AutoCompleteTextView) searchBar.findViewById(searchBar.getContext().getResources().getIdentifier("android:id/search_src_text", null, null)); searchTextContent.setTextSize(15); //Set the text size searchTextContent.setGravity(Gravity.BOTTOM); //Set its gravity to bottom
You can use AutoCompleteTextView methods such as setHeight(), setPadding(), and many more to manipulate this view. More info here.

CommonSenseCode
- 23,522
- 33
- 131
- 186