Ply*_*nie 4 android colors android-actionbar
我试图在Android教程(这里)之后改变由Eclipse向导制作的新Android应用程序的ActionBar颜色,但是我遇到了一些问题.
我将minSdkVersion设置为10(它应该是android 2.1左右).
当我将此代码粘贴到themes.xml时(如教程所述):
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme"
parent="@style/AppTheme">
<item name="android:actionBarStyle">@style/MyActionBar</item>
<!-- Support library compatibility -->
<item name="actionBarStyle">@style/MyActionBar</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar"
parent="@style/AppTheme">
<item name="android:background">#FFFFFF</item>
<!-- Support library compatibility -->
<item name="background">#FFFFFF</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
Eclipse给我这些错误:
我修改了一些小东西(基本主题和颜色),但是干净的代码在教程中.
我的Styles.xml在这里:
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
有什么问题?
要使用api level 11下面的操作栏,您需要在项目中引用app compact(来自支持库).
您的课程需要扩展ActionBarActivity
,您需要使用Theme.AppCompat
.
http://developer.android.com/guide/topics/ui/actionbar.html
还检查一下
http://android-developers.blogspot.in/2013/08/actionbarcompat-and-io-2013-app-source.html
或者你需要使用 ActionBarSherlock
归档时间: |
|
查看次数: |
11387 次 |
最近记录: |