2015-04-19 26 views
0

我试图自定义我的ActionBar,我正在按照Android Developers - >Link的这个教程进行自定义,但它并没有改变,我在Android Manifest中指定了主题:ActionBar不会改变为Holo或Dark

android:theme="@android:style/Theme.Holo" and, in my styles.xml: 

而且我也改变了我的styles.xml:

<style name="AppTheme" parent="Theme.AppCompat"> 

</style> 

另外,我有库的最后一个版本:

enter image description here

,它是在我的应用程序Grandle引用:

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 22 
buildToolsVersion "21.1.2" 

defaultConfig { 
    applicationId "com.cheescake.juno" 
    minSdkVersion 14 
    targetSdkVersion 22 
    versionCode 1 
    versionName "1.0" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'),          

    `proguard-rules.pro' 
    } 
} 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
compile 'com.android.support:appcompat-v7:22.0.0' 
} 

我跟所有的步骤,我不知道为什么我的动作条是主题光呢。也许可以是一个愚蠢的错误,我didn't明白的东西,但我有2天,这个问题=(

感谢

回答

1
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
     <item name="colorPrimary">@color/colorPrimary</item> 
     <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
     <item name="colorAccent">@android:color/white</item> 
    </style> 

并在清单文件中

<application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" 
+0

谢谢,它的作品完美! –

+0

祝你好运兄弟:) – mustafasevgi

1

指定你的主题如的颜色后:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> .... </style>

以下行添加到AndroidManifest.xml文件

<application 
    ... 
    android:theme="@style/AppTheme" > 
....