2017-05-09 3 views
0

테마를 재정의하여 애플리케이션의 색상을 변경하고 싶습니다. 나는 사용자가 선택할 수있는 몇 가지 주제가 있습니다. 테마를 오버라이드 (override) 할 때 나는 안드로이드 Studio에서이 오류가 발생했습니다 :android : colorForegroundInverse에서 주어진 이름과 일치하는 리소스가 없습니다. @ color/foreground_material_light

어떤 자원은 안드로이드에서 지정된 이름과 일치 찾을 수 없습니다 : foreground_material_light/값 @ 색상으로

값 \ styles.xml

colorForegroundInverse을
<resources> 
    <style name="LigthTheme" parent="@style/Theme.AppCompat"> 
<!-- <item name="colorPrimary">@color/aztec_gold</item> 
    <item name="colorPrimaryDark">@color/licorice</item> 
    <item name="colorAccent">@color/accent_material_light</item> 
    <item name="android:itemBackground">@color/aztec_gold</item> 
    <item name="android:background">@color/aztec_gold</item> 
    --> 
</style> 

<style name="RetroTheme" parent="@style/Theme.AppCompat"> 
    <!-- Customize your theme here. --> 
    <item name="colorPrimaryDark">@color/nickel</item> 
    <item name="colorPrimary">@color/spanish_gray</item> 
    <item name="colorAccent">@color/turtle_green</item> 
    <item name="android:windowBackground">@color/white_smoke</item> 
    <item name="android:colorBackground">@color/white_smoke</item> 
    <item name="android:textColorPrimary">@color/black</item> 
    <item name="android:textColorSecondary">@color/black_light</item> 
    <item name="android:textColorSecondaryInverse">@color/white</item> 
    <item name="android:textColorPrimaryInverse">@color/white_smoke</item> 
    <item name="android:colorForeground">@color/white_smoke</item> 
    <item name="colorButtonNormal">@color/june_bud</item> 
    <item name="android:colorForegroundInverse">@color/white_smoke</item> 
</style> 


<style name="DarkTheme" parent="@style/Theme.AppCompat"> 
<!--  <item name="colorPrimary">@color/aztec_gold</item> 
    <item name="colorPrimaryDark">@color/licorice</item> 
    <item name="colorAccent">@color/accent_material_light</item> 
    <item name="android:itemBackground">@color/aztec_gold</item> 
    <item name="android:background">@color/aztec_gold</item> 
    --> 
</style> 

값 \ colors.xml

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <color name="spanish_gray">#9e9e9e</color> 
    <color name="pastel_gray">#cfcfcf</color> 
    <color name="nickel">#707070</color> 
    <color name="june_bud">#aed851</color> 
    <color name="pale_goldenrod">#e1ffb1</color> 
    <color name="turtle_green">#7da453</color> 
    <color name="white_smoke">#f5f5f5</color> 
    <color name="black">#d2000000</color> 
    <color name="black_light">#9c000000</color> 
    <color name="black_light1">#9c000000</color> 
    <color name="white">#ffffff</color> 
</resources> 

build.gradle

styles.xml에 colorForegroundInverse 및 foreground_material_light을 넣어 시도
apply plugin: 'com.android.application' 

android { 
compileSdkVersion 24 
buildToolsVersion "25.0.2" 

defaultConfig { 
    applicationId "com.ivan.vts.mapper" 
    minSdkVersion 16 
    targetSdkVersion 24 
    versionCode 1 
    versionName "1.0" 
    multiDexEnabled true 
    jackOptions { 
     enabled true 
    } 

} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
compileOptions { 
    targetCompatibility JavaVersion.VERSION_1_8 
    sourceCompatibility JavaVersion.VERSION_1_8 
} 

dexOptions { 
    javaMaxHeapSize "2048M" 
} 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
compile group: 'com.google.code.gson', name: 'gson', version: '2.4' 
compile group: 'commons-io', name: 'commons-io', version: '2.5' 
compile 'com.android.volley:volley:1.0.0' 
compile 'com.android.support:appcompat-v7:24.0.0' 
compile 'com.google.android.gms:play-services-location:10.2.4' 
compile 'com.google.android.gms:play-services-maps:10.2.4' 
compile 'com.google.android.gms:play-services-places:10.2.4' 
compile 'com.android.support:multidex:1.0.1' 
compile 'cn.pedant.sweetalert:library:1.3' 
compile 'com.android.support.constraint:constraint-layout:1.0.2' 
compile 'com.google.maps.android:android-maps-utils:0.4.+' 
testCompile 'junit:junit:4.12' 
} 

, colors.xml, BT 항상 다른 테마 같은 오류로 설정 부모입니다. 미리 감사드립니다.

편집 : <color name="foreground_material_light">#fff</color> 및 경고가하지만 오류 : 내가 좋아하는 colors.xml 뭔가를 추가 할 수 없습니다. 나에게 맞는 느낌이 들지 않습니다.

답변

0

당신은 @android:color/foreground_material_light

+0

로 색상을 액세스하는 시도 할 수 있습니다 액세스가 존재하지 않기 때문에 할 수 없습니다. 그래서 나는 내 질문을 업데이트 할 것이다. – Chiefster

+0

'compile'com.android.support : appcompat-v7 : 25.0.1''을 gradle 의존성에 추가하십시오. – VishnuSP

+0

직장에서 집에있을 때 시도하겠습니다. 감사합니다. – Chiefster