动作条分频器造型 [英] ActionBar Divider Styling
问题描述
我有两个问题。在详细这些问题,我想我用添加 ActionBarSherlock
。
I have two questions. Before detailing these questions, I want to add I'm using ActionBarSherlock
.
第一个问题将是,我有我的动作条
之间加入 ActionItems
除法问题。在PRINTSCREEN,有3个分隔,比如第一个是返回键之间的和查看在。
The first question would be that I am having issues with adding a divider between ActionItems
in my ActionBar
. In the printscreen, there are 3 dividers, for instance the first one is between the back button and Check In.
我用下面的风格定制了自己的动作条。然而,所谓的绘制 small_detail_divider
不出来。我也试过编程添加此分频器,使用 setBackgroundSplitDrawable()
。这并没有帮助。我应该怎么做才能添加这些之间的分隔 ActionItem
S'
I customized my ActionBar using the style below. However, the drawable called small_detail_divider
does not show up. I also tried adding this divider programmatically, using the setBackgroundSplitDrawable()
. That did not help either. What should I do to add divider between those ActionItem
s?
<style name="Theme.Example" parent="Theme.Sherlock">
<item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
<item name="absForceOverflow">true</item>
</style>
<style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.ActionBar.Solid">
<item name="background">@drawable/top_panel_background</item>
<item name="icon">@drawable/application_logo</item>
<item name="backgroundSplit">@drawable/small_detail_divider</item>
<item name="android:background">@drawable/top_panel_background</item>
<item name="android:icon">@drawable/application_logo</item>
<item name="android:backgroundSplit">@drawable/small_detail_divider</item>
</style>
另一个问题是:我想,因为它们是在PRINTSCREEN中添加相同的方式添加行动项目。当我添加的行动项目,它们总是添加到动作条
的权利。我该如何行动项目添加到左侧的动作条
如在PRINTSCREEN后退按钮?任何建议将帮助。
Another question would be: I want to add action items in the same manner as they are added within the printscreen. When I add the action items, they are always added to the right of the ActionBar
. How can I add an action item to the left of the ActionBar
such as the Back Button in the printscreen? Any suggestion would help.
推荐答案
您正在寻找的属性是:
<style name="Theme.Example" parent="Theme.Sherlock">
<item name="actionBarDivider">@drawable/small_detail_divider</item>
....
<item name="android:actionBarDivider">@drawable/small_detail_divider</item>
...
</style>
只给你一些更多的信息。
Just to give you some more info.
拆分动作条应设置为:
<style name="Theme.Example" parent="Theme.Sherlock">
<item name="actionBarSplitStyle">@style/Widget.Styled.ActionBarSplit</item>
<item name="android:actionBarSplitStyle">@style/Widget.Styled.ActionBarSplit</item>
...
然后提供您的自定义样式拆分操作栏。
Then provide your custom style for the split action bar..
第三人利益的问题:加入顺序:
Thrid question: Adding in order:
当您添加菜单项务实地使用:<一href="http://developer.android.com/reference/android/view/Menu.html#add%28int,%20int,%20int,%20java.lang.CharSequence%29">Menu
When you add the menu item pragmatically use: Menu
menu.add(0,R.id.menu_new_ab_item,0,项目);
顺序确定如何订购你的菜单项。
The order determines how you order your menu items.
您可以更具体的在你的menu.xml文件的文件安卓orderInCategory =1..1
可以是任何int类型。我通常开始在10个左右,这样我就可以在充气前期的标准项目的项目。
You can be more specific in your menu.xml files android:orderInCategory="1..n"
can be any int. I normally start at 10 or so, so I can inflate items in-front of the standard items.
这篇关于动作条分频器造型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!