ActionBar自定义布局像ICS编辑联系人

问题描述:

我刚刚开始使用支持ActionBar的新支持库。我试图在编辑联系人屏幕上实现一个与冰淇淋三明治布局基本相同的酒吧。我知道我可能需要实现一个类似于此的自定义视图 - How to display custom view in ActionBar?。我不明白的正是这种观点,以及实施它的最佳方式。ActionBar自定义布局像ICS编辑联系人

这里是什么,我想在我的动作条截图:

enter image description here

是,仅仅一个带有图片和一些文字,或风格的按钮,或者什么看法完全不同?它有一些状态按下的属性。

感谢您的帮助。

当你想按钮出现您可以尝试使用自定义视图,通过添加以下代码:

// Inflate the view from XML file 
LayoutInflater inflator = (LayoutInflater) this .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
View v = inflator.inflate(R.layout.search, null); 

// Tell the view to occupy the whole actionBar view (MATCH_PARENT) 
LayoutParams layout = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); 
getActionBar().setCustomView(v, layout);