Android 夏洛克动作吧风格
我想在整个应用程序中设置动作栏的样式,使其具有背景色。目前我使用Android 夏洛克动作吧风格,android,actionbarsherlock,Android,Actionbarsherlock,我想在整个应用程序中设置动作栏的样式,使其具有背景色。目前我使用 getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.bg_top)) 在我的每项活动中,但我希望这是一个全球性的定义。其次,我不希望每个活动操作栏中都有图标。如何做到这一点 问候 这是我的风格。我希望标题保留,但图标被隐藏 <?xml version="1.0" encoding="utf-8"?>
getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.bg_top))
在我的每项活动中,但我希望这是一个全球性的定义。其次,我不希望每个活动操作栏中都有图标。如何做到这一点
问候
这是我的风格。我希望标题保留,但图标被隐藏
<?xml version="1.0" encoding="utf-8"?>
@style/Widget.myteme.ActionBar
@style/Widget.myteme.ActionBar
@可拉拔式/bg_顶部
@可拉拔式/bg_顶部
@style/Theme.ActionBar.TitleTextStyle
@style/Theme.ActionBar.TitleTextStyle
useLogo
useLogo
@颜色/白色
要在整个应用程序中设置相同的背景色,请执行以下操作: 在AndroidManifest中添加以下样式:
< application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.MyTheme"
android:name=".MyApp" >
<应用程序
android:icon=“@drawable/ic_启动器”
android:label=“@string/app\u name”
android:theme=“@style/theme.MyTheme”
android:name=“.MyApp”>
然后在样式文件中添加以下内容:
<style name="Theme.MyTheme" parent="Theme.Sherlock.Light">
<item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
<item name="android:actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
</style>
<style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
<item name="android:background">#ff3399CC</item>
<item name="background">#ff3399CC</item>
</style>
@style/Widget.myteme.ActionBar
@style/Widget.myteme.ActionBar
#ff3399CC
#ff3399CC
然后可以更改颜色或添加任何其他样式
也许这有助于标识:
对不起,第一部分起作用了。图标不是。我已经编辑了我的问题来显示发生了什么。我正在做类似的事情!!!
<style name="Theme.MyTheme" parent="Theme.Sherlock.Light">
<item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
<item name="android:actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
</style>
<style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
<item name="android:background">#ff3399CC</item>
<item name="background">#ff3399CC</item>
</style>