上面的动作条小酒吧 [英] Tiny bar above ActionBar
问题描述
我想有一个以上的蓝条我动作条
(不使用 ActionBarSherlock
)象下面这样:
I'd like to have a blue bar above my ActionBar
(not using ActionBarSherlock
) like below:
我试图通过注入自定义视图getActionBar()。setCustomView(...)
但是它只出现在操作栏和右侧文字的左侧,标志。我想了吧,以填补上述操作栏上的应用程序的整个宽度。
I tried to injecting a custom view via getActionBar().setCustomView(...)
but it only appears in left side of action bar and right side of title and logo. I want the bar to fill the whole width of the app above action bar.
你知道吗?
更新
应用@ Android的开发者解决方案后的截图:
The screenshot after applying @Android-Developer solution:
推荐答案
您可以创建一个9patch图像作为动作条
的背景或XML文件创建它,这看起来应该类似这样:
You can create a 9patch image as your ActionBar
s background or create it with an xml file, which should look something similar to this :
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#5eccff"/>
</shape>
</item>
<item android:bottom="-1dp" android:left="-1dp" android:right="-1dp" android:top="2dp">
<shape android:shape="rectangle">
<solid android:color="#CCCCCC" />
<corners android:radius="0dp" />
</shape>
</item>
</layer-list>
</item>
</selector>
希望这有助于你。
Hope this helps you.
更新由阿夫欣
@ Android的开发者写了下面的第一项
@Android-Developer wrote the following for first item
<stroke android:width="1dp" android:color="#33B5E5" /
因为笔画
没有工作对我来说,我用它取代实
来填充整个背景蓝色:
since the stroke
didn't worked for me, I replaced it with solid
to fill the whole background with blue color:
<solid android:color="#5eccff"/>
这篇关于上面的动作条小酒吧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!