Skip to content Skip to sidebar Skip to footer

How To Remove Inner Bottom Space (bottom Margin/padding) Of Text/layout Inside A Searchview?

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):

Solution 1:

  1. Imagine you have SearchView named: searchBar

    SearchViewsearchBar= (SearchView) findViewById(R.id.searchViewBar);
    
  2. Get the view (AutoCompleteTextView) that holds the text inside your SearchView:

    //The view that contains the SearchView textAutoCompleteTextViewsearchTextContent= (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.

Post a Comment for "How To Remove Inner Bottom Space (bottom Margin/padding) Of Text/layout Inside A Searchview?"