2017-08-12 2 views
-1

Je veux un thème de couleur sombre.Comment modifier correctement le thème de l'interface utilisateur?

j'ai changé les éléments suivants dans styles.xml:

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

à

<style name="AppTheme" parent="android:Theme.Black"> 

et j'ai essayé aussi beaucoup d'autres cordes qui soit ne compilent pas ou provoquer le même accident. écran Android montre:

08-11 20:07:00.938 29773-29773/? I/zygote: Not late-enabling -Xcheck:jni (already on) 
08-11 20:07:00.956 29773-29773/? W/zygote: Unexpected CPU variant for X86 using defaults: x86 
08-11 20:07:01.122 29773-29773/com.example.timothyswan.myapplication I/InstantRun: starting instant run server: is main process 
08-11 20:07:01.283 29773-29805/com.example.timothyswan.myapplication D/OpenGLRenderer: HWUI GL Pipeline 
08-11 20:07:01.457 29773-29805/com.example.timothyswan.myapplication I/OpenGLRenderer: Initialized EGL, version 1.4 
08-11 20:07:01.457 29773-29805/com.example.timothyswan.myapplication D/OpenGLRenderer: Swap behavior 1 
08-11 20:07:01.457 29773-29805/com.example.timothyswan.myapplication W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without... 
08-11 20:07:01.457 29773-29805/com.example.timothyswan.myapplication D/OpenGLRenderer: Swap behavior 0 
08-11 20:07:01.459 29773-29805/com.example.timothyswan.myapplication D/EGL_emulation: eglCreateContext: 0xaa4b1920: maj 2 min 0 rcv 2 
08-11 20:07:01.461 29773-29805/com.example.timothyswan.myapplication D/EGL_emulation: eglMakeCurrent: 0xaa4b1920: ver 2 0 (tinfo 0x9e4aa9f0) 

                         [ 08-11 20:07:01.479 29773:29805 D/   ] 
                         SurfaceInterface::setAsyncMode: set async mode 1 
08-11 20:07:01.493 29773-29805/com.example.timothyswan.myapplication D/EGL_emulation: eglMakeCurrent: 0xaa4b1920: ver 2 0 (tinfo 0x9e4aa9f0) 

Et la console 'run' indique:

08/11 22:01:07: Launching app 
$ adb shell am start -n "com.example.timothyswan.myapplication/com.example.timothyswan.myapplication.InspirationBasic" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER 
Client not ready yet..Waiting for process to come online 
Connected to process 6973 on device emulator-5554 
Application terminated. 
+0

Ce ne sont pas les journaux crash réels de l'application –

+0

https://medium.com/google-developers/theming- avec-appcompat-1a292b754b35 –

Répondre

1

Le thème d'un AppCompatActivity (non Activity) doit être un descendant d'un Theme.AppCompat. Donc, vérifiez si votre activité s'étend AppCompatActivity ou non. Si oui, changer étend Activity, ou faire votre propre thème qui hérite de Theme.AppCompat et d'appliquer à votre activité