我希望通过覆盖主题来更改应用程序中的颜色。我有几个主题,用户可以选择。尝试覆盖主题时,我在Android Studio中收到此错误:
找不到与android:colorForegroundInverse上的给定名称匹配的资源,其值为@ color / foreground_material_light
值\ styles.xml
String response = // your response string
TestPojo testPojo = new Gson().fromJson(response, TestPojo.class);
值\ colors.xml
<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>
的build.gradle
<?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>
尝试将colorsForegroundInverse和foreground_material_light放在styles.xml,colors.xml中,将parent设置为不同的主题bt始终是相同的错误。 提前谢谢。
编辑:
我可以添加colors.xml之类的东西:
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'
}
并且有警告,但没有错误。它对我来说不合适。
答案 0 :(得分:0)
您可以尝试访问颜色
*/5 * * * * . /home/ubuntu/filename.sh >> /filename.sh