2016-05-28 53 views
0

我正在开发使用Android Studio的Android应用程序。坦率地说,我不擅长Android开发。我在设置主题到我的应用程序时遇到问题。我将样式资源文件中的整个应用程序的文本颜色设置为主题。但它不起作用。请参阅下面的我的场景。将文字颜色设置为Android中的主题无效

这是我的颜色资源文件

enter image description here

正如你所看到的,我都设置文本颜色为红色。

这是我的风格的资源文件的主题

enter image description here

我设置了主题为这样

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

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

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

</manifest> 

但当清单文件中的应用我运行的文字颜色不变。你可以在下面看到。

enter image description here

所以请为什么它不工作?我该如何修复我的代码?我怎样才能为整个应用程序设置文本颜色?

回答

0

您的活动主题正确设置为AppTheme.NoActionBar。但是,该主题在styles.xml中没有父项,这意味着TextView颜色不会从默认值更改。你可以通过像这样继承AppTheme来解决这个问题:

<style name="AppTheme.NoActionBar" parent="AppTheme"> 
相关问题