Android操作栏,主题 [英] Android Action Bar theme

查看:164
本文介绍了Android操作栏,主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Titanium" parent="android:Theme.NoTitleBar.Fullscreen">
    <item name="android:windowBackground">@drawable/background</item>
</style>
</resources>

如何使用theme.xml定制我的ActionBar组件。我试图生成这些文件,在我的平台/安卓/ res文件夹没有到位,但没有运气

<一个href=\"http://jgilfelt.github.com/android-actionbarstylegenerator/#name=ActionBar&compat=holo&theme=light&actionbarstyle=solid&backColor=ffffff%2C100&secondaryColor=1f6e0d%2C100&tertiaryColor=F2F2F2%2C100&accentColor=fafffb%2C100\" rel=\"nofollow\">http://jgilfelt.github.com/android-actionbarstylegenerator/#name=ActionBar&compat=holo&theme=light&actionbarstyle=solid&backColor=ffffff%2C100&secondaryColor=1f6e0d%2C100&tertiaryColor=F2F2F2%2C100&accentColor=fafffb%2C100

推荐答案

做这样的:

  <style name="CustomStyle" parent="@android:style/Theme.Holo.Light">
        <item name="android:actionBarStyle">@style/CustomActionBar</item>
  </style>

  <style name="CustomActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
        <item name="android:background">@drawable/ANY_DRAWABLE</item>
        <item name="android:displayOptions">useLogo|showHome</item>
        ...
        <item name="PARAM">VALUE</item>
  </style>

在CustomActionBar风格,你可以设置动作条PARAMS。在活动中使用CustomStyle。

In CustomActionBar style you can set ActionBar params. In your Activities use CustomStyle.

更新::您可以在清单使用CustomStyle所有应用。只要做到这一点:

UPDATE : You can use CustomStyle in Manifest for all Application. Just do it :

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/CustomStyle">

或使用每个活动:

 <activity
     android:name="MainActivity"
     android:label="@string/app_name" 
     android:screenOrientation="portrait"
     android:theme="@style/CustomStyle">

祝你好运!

这篇关于Android操作栏,主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆