2014-11-05 3 views
0

나는 흰색의 색상을 설정하지만 변경되지 않습니다 : activity_my.xml :안드로이드 액션 바 색상을 변경 하시겠습니까?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    tools:context=".MyActivity" 
    android:theme="@style/AppTheme"> 

</RelativeLayout> 

style.xml을

<resources> 

    <!-- Base application theme. --> 
    <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> 
     <item name="android:actionBarStyle">@style/ActionBar</item> 
    </style> 
    <style name="ActionBar"> 
     <item name="android:background">#ffffff</item> 
    </style> 
</resources> 

나는했습니다 AndroidManifest.xml을

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="eu.test.test.test" > 

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name=".MyActivity" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
    </application> 

</manifest> 

수색되었지만, 어디에서나 이런 식으로 설명됩니다.

androidmanifest 파일을 추가했습니다. 그나마 잊지

+0

ActionBar bar = getActionBar(); bar.setBackgroundDrawable (새 ColorDrawable ("COLOR")); –

+0

이 색상에는 #ffffff 또는 rgb 변형 오류가 적용될 수 없습니다. – emanuilov

+0

간단한 활동에서 sharelack 활동 사용 –

답변

0

AndroidManifest applicaton/활동 테마로합니다 (relative layout에서 하지)에서 AppTheme을 만들었을 사용할 수 있습니다.

당신은 스타일 태그에 넣어되지 않은
<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
+0

거기에 추가되었습니다. – emanuilov

+0

android : theme = "@ style/AppTheme"을 상대 레이아웃에서 삭제 했습니까? –

+0

다시 색깔을 변경하지 않습니다. – emanuilov

0
<style name="AppTheme" parent="android:style/Theme.Holo.Light.DarkActionBar"> 
    <item name="android:actionBarStyle">@style/ActionBar</item> 
    </style> 
<style name="ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar"> 
    <item name="android:background">@color/dark_grey</item> 
</style> 

"부모"

예제 응용 프로그램 테마를 설정합니다. 그것을 시도 할 수 있습니다!