Android 钛安卓动作条主题
我使用SDK3.0,通过下面的xml,我可以将选项卡更改为Holo Dark主题。有没有可能改变fontsize,因为我得到的那个会给我一个可滑动的标签条?我能换成粉红色而不是蓝色吗Android 钛安卓动作条主题,android,tabs,themes,titanium,titanium-mobile,Android,Tabs,Themes,Titanium,Titanium Mobile,我使用SDK3.0,通过下面的xml,我可以将选项卡更改为Holo Dark主题。有没有可能改变fontsize,因为我得到的那个会给我一个可滑动的标签条?我能换成粉红色而不是蓝色吗 <android xmlns:android="http://schemas.android.com/apk/res/android"> <tool-api-level>14</tool-api-level> <manifest> <ap
<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>14</tool-api-level>
<manifest>
<application android:theme="@android:style/Theme.Holo"></application>
</manifest>
</android>
但我无法让它工作。否则,这正是我想要的。我正在使用支持所有平台上的操作栏。它提供了巨大的定制造型机会。我把蓝色的分隔符换成了绿色的。以下是我的xml:
AndroidManifest.xml
<application android:theme="@style/Theme.GreenAB"></application>
/res/values/abs\u green\u style.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.GreenAB" parent="Theme.Sherlock.ForceOverflow">
<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">@drawable/green_style</item>
<item name="background">@drawable/green_style</item>
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Green Bottom Line -->
<item>
<shape android:shape="rectangle">
<solid android:color="#FF177506" />
</shape>
</item>
<!-- Color of the action bar -->
<item android:bottom="2dip">
<shape android:shape="rectangle">
<solid android:color="#000000" />
</shape>
</item>
</layer-list>
@style/Widget.myteme.ActionBar
@style/Widget.myteme.ActionBar
@可拉伸/绿色
@可拉伸/绿色
/res/drawable/green_style.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.GreenAB" parent="Theme.Sherlock.ForceOverflow">
<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">@drawable/green_style</item>
<item name="background">@drawable/green_style</item>
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Green Bottom Line -->
<item>
<shape android:shape="rectangle">
<solid android:color="#FF177506" />
</shape>
</item>
<!-- Color of the action bar -->
<item android:bottom="2dip">
<shape android:shape="rectangle">
<solid android:color="#000000" />
</shape>
</item>
</layer-list>
如果您不需要所有平台上的支持,您甚至可以在没有第三方库的情况下使用它。将父主题(theme.Sherlock.ForceOverflow)替换为Android资源,并删除样式部分中的重复项。您可以使用自定义ActionBar主题。该工具为您提供“res”文件夹中所需的所有资源。只需将该文件夹复制到应用程序根项目目录下的platform/android
在自定义清单中或直接在tiapp.xml中,您通过名称引用该主题:
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<application android:theme="@style/Theme.myCustomActionBarTheme" />
</manifest>
</android>
这个解决方案对我来说非常好——我希望它能有所帮助 我写了一篇关于如何在Tianium Mobile中使用自定义全息主题的博文:
这类似于manumaticx的回答。我犯了很多错误。[错误]/Users/hugocarmartin/Documents/Titanium\u Studio\u Workspace/kattproblem an droid/build/android/res/values/style\u mycustomstyle.xml:21:ERROR:ERROR:ERROR检索项的父项时出错:未找到与给定名称“@android:sty le/Theme.Holo”匹配的资源。[错误]/Users/hugocarmartin/Documents/Titanium\u Studio\u Workspace/kattproblem an droid/build/android/res/values/styles\u mycustomstyle.xml:22:ERROR:ERROR:ERROR:No找到与给定名称匹配的资源:attr“android:actionBarItemBackground”。等等……您是否已将主题的名称替换为与您在样式生成器中输入的名称完全相同的名称?还要确保项目根目录中的platform/android/res/目录?我不需要/values中的theme.xml,对吗?你使用的是什么Ti SDK?你不需要在res/…中创建另一个文件。。。只需将整个文件夹复制到您的项目中。查看/res/values/styles.xml时,中的第一个样式项将告诉您自定义主题的名称(由样式生成器创建)。您应该在自定义清单中使用此名称来引用该主题
非常感谢,在生成器中,我用camelstyle命名它。但是在styles.xml中是小写字母。工作完美!!