如何在SearchView中删除文本/布局的内部底部空间(底部边距/填充)? [英] How to remove inner bottom space (bottom margin/padding) of text/layout inside a SearchView?
本文介绍了如何在SearchView中删除文本/布局的内部底部空间(底部边距/填充)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我得到了这个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):
推荐答案
-
假设您有
SearchView
名为:searchBar
SearchView searchBar = (SearchView) findViewById(R.id.searchViewBar);
获取将文本保存在SearchView
中的视图(AutoCompleteTextView
):
Get the view (AutoCompleteTextView
) that holds the text inside your SearchView
:
//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
您可以使用AutoCompleteTextView方法(例如setHeight(),setPadding()等)来操纵此视图.更多信息此处.
You can use AutoCompleteTextView methods such as setHeight(), setPadding(), and many more to manipulate this view. More info here.
这篇关于如何在SearchView中删除文本/布局的内部底部空间(底部边距/填充)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文