【问题标题】:Set Spacing Between Action Item Icons Programmatically / Dynamically以编程方式/动态设置操作项图标之间的间距
【发布时间】:2015-05-07 21:28:40
【问题描述】:

根据下面的链接,他们展示了如何控制 xml 中操作项图标之间的间距/填充。

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

@style/ActionButtonStyle 魔法就在这里:

0倾角 0倾角 0dip
通常 minWidth 设置为 56 dip。

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

【问题讨论】:

    标签: android android-actionbar padding


    【解决方案1】:
    @Override
            public boolean onCreateOptionsMenu (Menu menu){
    
                getMenuInflater().inflate(R.menu.base_menu, menu);
                toolbar.getChildAt(3); //ActionMenuView
    
            }
    

    请注意:位置取决于您在工具栏中的查看次数,之后您可以通过设置自定义Toolbar.LayoutParams轻松控制测量值

    【讨论】:

      猜你喜欢
      • 2014-10-09
      • 2016-09-14
      • 1970-01-01
      • 2017-09-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多