2016-10-06 2 views
1

Ich versuche zu lernen, wie benutzerdefinierte App-Designs in Android bearbeitet werden.Android-Designänderungen ändern sich nicht zuverlässig

Aber aus irgendeinem Grund werden Änderungen in meiner styles.xml (manuell und mit Theme-Editor) widersprüchlich auf meinem Gerät widergespiegelt. Das Verhalten ist verblüffend.

Wie ich 50 Build, reinigt, umbauen, etc letzte Nacht versucht, Option Menüelemente Text zu bekommen, Farbe zu ändern und es würde nicht. Dann hat es sich heute geändert ... und ich weiß nicht warum.

Ich versuche, die Haupthintergrundfarbe zu ändern, und es würde sich nicht ändern. Dann änderte sich nach einem Build plötzlich die Hintergrundfarbe des Optionsmenüs in die Farbe, in der ich die Haupthintergrundfarbe eingestellt hatte.

Ich habe nichts zuverlässiges oder reproduzierbares in diesem Problem gefunden.

Thema Änderungen funktionieren nur für mich nicht und wenn sie es tun, ist es sporadisch.

Ich habe Instant Run deaktiviert und deinstallierte App sowie gereinigt, neu aufgebaut und Projekt gemacht. Keine dieser Aktionen hat Auswirkungen darauf, ob sich Änderungen am Thema auswirken.

Meine v11, v14 und v21 styles.xml sind leer, und ich modifiziere nur die Hauptstile.xml.

styles.xml

<resources> 

<style name="AppBaseTheme" parent="android:Theme.Material"> 
    <!-- 
    Theme customizations available in newer API levels can go in 
    res/values-vXX/styles.xml, while customizations related to 
    backward-compatibility can go here. 
    --> 
    <item name="android:colorBackground">@color/black</item> 
    <item name="android:colorForeground">@color/common_signin_btn_dark_text_pressed</item> 
    <item name="android:textColorPrimary">@color/text_color_primary</item> 
    <item name="android:textColorSecondary">@color/text_color_secondary</item> 
    <item name="android:textColorSecondaryInverse">@color/text_color_inverse</item> 
    <item name="android:textColor">@color/text_color_primary</item> 
    <item name="android:itemTextAppearance">@style/MenuItemTextAppearance</item> 
    <item name="android:dialogTheme">@style/DialogTheme</item> 
</style> 

<style name="MenuItemTextAppearance"> 
    <item name="android:textColor">#000000</item> 
</style> 

<style name="DialogTheme" parent="android:Theme.Material.Dialog.Alert"> 
    <item name="android:colorBackground">@color/background</item> 
</style> 

androidmanifest 

<?xml version="1.0" encoding="utf-8"?> 
<manifest package="com.me.myapp" 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:versionCode="1" 
      android:versionName="1.0"> 

    <uses-sdk 
     android:minSdkVersion="16" 
     android:targetSdkVersion="21"/> 

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> 
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> 
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/> 

    <application 
     android:name=".LocalApp" 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppBaseTheme"> 
     <activity 
      android:name=".ActMain" 
      android:label="@string/app_name"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN"/> 
       <category android:name="android.intent.category.LAUNCHER"/> 
      </intent-filter> 
     </activity> 
     <activity 
      android:name=".ActExport" 
      android:label="@string/title_activity_export" 
      android:windowSoftInputMode="stateAlwaysVisible"> 
     </activity> 
     <!-- 
      ATTENTION: This was auto-generated to add Google Play services to your project for 
      App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information. 
     --> 
     <meta-data 
      android:name="com.google.android.gms.version" 
      android:value="@integer/google_play_services_version"/> 

     <activity 
      android:name=".ActSaveFile" 
      android:label="@string/title_activity_act_save_file"> 
     </activity> 
     <activity 
      android:name=".ActLoadFile" 
      android:label="@string/title_activity_act_load_file"> 
     </activity> 
    </application> 

</manifest> 

Antwort

0

Ihr Stil AppBasteTheme, die von Android erweitert: Theme.Material nur über 21 sdk Ebene Ihre min sdk Level 15 unterstützt wird, ist die small.Instead ist Verwenden Sie diesen Stil, der gut funktioniert.

<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
<!-- 
Theme customizations available in newer API levels can go in 
res/values-vXX/styles.xml, while customizations related to 
backward-compatibility can go here. 
--> 
<item name="android:colorBackground">@color/black</item> 
<item name="android:colorForeground">@color/common_signin_btn_dark_text_pressed</item> 
<item name="android:textColorPrimary">@color/text_color_primary</item> 
<item name="android:textColorSecondary">@color/text_color_secondary</item> 
<item name="android:textColorSecondaryInverse">@color/text_color_inverse</item> 
<item name="android:textColor">@color/text_color_primary</item> 
<item name="android:itemTextAppearance">@style/MenuItemTextAppearance</item> 
<item name="android:dialogTheme">@style/DialogTheme</item> 

+0

Dies erklärt nicht das Verhalten, das ich sehe. – ScottF

+0

Fehler: (119) Fehler beim Abrufen des übergeordneten Elements für Element: Keine Ressource gefunden, die den angegebenen Namen "Theme.AppCompat.Light" entspricht. – ScottF

0

Sie haben wie diese Sie zusätzliche Stile verpasst zu schreiben.

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
</style> 

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> 

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> 
Verwandte Themen