工具栏中SearchView和crashIcon之间的边距 [英] Margin between SearchView and collapseIcon in toolbar
问题描述
我试图用Toolbar
上的collapseIcon
实现android.support.v7.widget.SearchView
.一切正常,即SearchView
可以正常工作,但是我无法删除/减少SearchView
和collapseIcon
之间的填充,如所附的屏幕快照所示.
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?
我尝试过:
app:contentInsetStartWithNavigation="0dp"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
android:contentInsetLeft="0dp"
android:contentInsetStart="0dp"
但这是行不通的.
推荐答案
我设法通过查看SearchView
使用的xml文件解决了该问题,因此可以通过更改leftMargin
来删除/减少填充值:
I managed to solve the problem by looking at the xml file that's used by SearchView
, so the padding can be removed/reduced by changing the leftMargin
value:
layoutParams.leftMargin = 0;
对于SearchView
中的以下LinearLayout
:
LinearLayout searchEditFrame = (LinearLayout) searchView.findViewById(R.id.search_edit_frame);
这篇关于工具栏中SearchView和crashIcon之间的边距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!