根据下面的链接,他们展示了如何控制 xml 中操作项图标之间的间距/填充。
但是,间距是固定的,对我来说不够灵活。我可以动态/以编程方式设置填充吗? 非常感谢。
@style/ActionButtonStyle 魔法就在这里:
0dip
0dip
0点
normaly minWidth 设置为 56 dip。
Is there a way to reduce the spacing between the Action Item Icons on Action Bar?
最佳答案
@Override
public boolean onCreateOptionsMenu (Menu menu){
getMenuInflater().inflate(R.menu.base_menu, menu);
toolbar.getChildAt(3); //ActionMenuView
}
请注意:位置取决于您在工具栏中的 View 数量,并且您可以通过设置自定义 Toolbar.LayoutParams
关于android - 以编程方式/动态方式设置操作项图标之间的间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28896022/