【问题标题】:How to change titanium alloy action bar background color如何更改钛合金动作条背景颜色
【发布时间】:2015-05-12 17:26:06
【问题描述】:

我是钛开发的新手。我如何创建自定义合金主题或更改全息主题操作栏背景。如果您有解决方案,请帮我举个例子。

【问题讨论】:

  • 欢迎来到 SO。请提供您目前拥有的代码。要知道这不是获取密码的地方。

标签: titanium titanium-alloy


【解决方案1】:

最好的方法是使用这个“动作栏生成器”。它的作品让我惊叹。 ActionBar Generator

【讨论】:

  • 操作栏生成器已折旧。从 4.0.0 版开始,Titanium SDK 公开了 Material Theme 调色板属性
【解决方案2】:

您应该查看 Appcelerator 论坛中的 this thread。简而言之:您创建一种样式,您可以在其中定义颜色并将其应用于操作栏。

【讨论】:

    【解决方案3】:

    Android Themes documentation

    例子:

    platform/android/res/values/builtin_themes.xml

     <!-- Works for Titanium SDK 3.2.x and earlier when built against Android 4.0x/API Level 14 -->
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <!-- Available for Android 4.0.x/API Level 14 and later -->
        <style name="LightDarkBar" parent="@android:style/Theme.Holo.Light.DarkActionBar"/> 
        <!-- Available for Android 3.0.x/API Level 11 and later -->
        <style name="Light" parent="@android:style/Theme.Holo.Light"/>
        <style name="Dark" parent="@android:style/Theme.Holo"/>
        <!-- Available for all Android versions -->
        <style name="OldLight" parent="@android:style/Theme.Light"/>
        <style name="OldDark" parent="@android:style/Theme.Black"/>
    </resources>
    

    修改 tiapp.xml 的 Android 部分

    <android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest>
            <application android:theme="@style/LightDarkBar"/>
            <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19"/>
        </manifest>
    </android>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-19
      • 1970-01-01
      • 2014-04-05
      • 2016-07-09
      • 2013-07-11
      • 2015-12-17
      • 2020-04-20
      相关资源
      最近更新 更多