在操作栏,如Gmail号码 [英] Number in Action Bar like Gmail
问题描述
我想在我的操作栏的右上角显示一个数据计数。
I'm trying to display a data count in the top right corner of my Action Bar.
如果我不会使用拆分操作栏,我只想创建在酒吧一个TextView,但它目前的not可能有在顶部操作栏项目,当你已经分手。
If I wouldn't be using a split action bar I would just create a TextView in the bar, but it's currently not possible to have items in the top Action Bar when you have split.
要澄清一下,我的意思是这样的:
To clarify, what I mean is this:
难道谷歌使用不同的操作栏的实现还是有办法做到这一点? 我想,我记得曾读到它,但我不能找到它是怎么叫。
Did Google use a different Action Bar implementation or is there a way to do this? I think I remember reading about it, but I can't find how it was called.
推荐答案
使用您的微调和文本视图顶部AB自定义视图,并启用安卓uiOptions =splitActionBarWhenNarrow
在清单中声明你的活动
Use a custom view with your spinner and text view for the top AB and enable the android:uiOptions="splitActionBarWhenNarrow"
in the manifest declaration for your activity
//set the actionbar to use the custom view (can also be done with a style)
getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
//set the custom view to use
getActionBar().setCustomView(R.layout.custom_ab);
其中, custom_ab.xml
与您的ImageView,微调和TextView的为计数。布局
Where custom_ab.xml
is a layout with your ImageView, Spinner and TextView for the count.
这篇关于在操作栏,如Gmail号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!