以编程方式/动态设置动作项目图标之间的间距

时间:2015-03-06 09:41:38

标签: android android-actionbar padding

根据以下链接,他们展示了如何控制 xml中的Action Item Icons之间的间距/填充。

但是,间距是固定的,对我来说不够灵活。我可以动态/编程设置填充吗? 非常感谢提前。

@风格/ ActionButtonStyle 而魔法在这里:

    0dip     0dip     0dip
normaly minWidth设置为56 dip。

Is there a way to reduce the spacing between the Action Item Icons on Action Bar?

1 个答案:

答案 0 :(得分:0)

@Override
        public boolean onCreateOptionsMenu (Menu menu){

            getMenuInflater().inflate(R.menu.base_menu, menu);
            toolbar.getChildAt(3); //ActionMenuView

        }

请注意:该位置取决于工具栏中的观看次数,以及您可以通过设置自定义Toolbar.LayoutParams

轻松控制测量值
相关问题