在android中添加主题不起作用

在android中添加主题不起作用,android,themes,Android,Themes,我创建了一个主题,并将其置于“值”类别: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="GreenText" parent="@android:style/TextAppearance"> <item name="android:textColor">#00FF00</item>

我创建了一个主题,并将其置于“值”类别:

    <?xml version="1.0" encoding="utf-8"?>
        <resources>
          <style name="GreenText" parent="@android:style/TextAppearance">
                <item name="android:textColor">#00FF00</item>
            </style>
        </resources>

#00FF00
//我的清单文件

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

    <uses-sdk android:minSdkVersion="3" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" 


 **android:theme="@style/GreenText"**
        >
        <activity
            android:label="@string/app_name"
            android:name=".LayoutsActivity" 

            >
            <intent-filter >
                <action android:name="android.intent.action.MAIN" />

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

</manifest>


The application cant launch.. what am I doing wrong!?!?

应用程序无法启动。。我做错了什么!?!?

要创建主题,您必须创建以下文件

  • 值文件夹中的themes.xml
  • values文件夹中的styles.xml
  • 在AndroidManifest.xml中应用主题
  • themes.xml

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
         <style name="MyTheme" parent="android:style/Theme.NoTitleBar">
            <item name="android:textViewStyle">@style/MyTheme.TextView</item>
        </style>
    </resources>
    
     <?xml version="1.0" encoding="utf-8"?>
            <resources>
              <style name="MyTheme.Textview" parent="@android:style/TextAppearance">
                    <item name="android:textColor">#00FF00</item>
                </style>
            </resources>
    
    <application
                android:icon="@drawable/ic_launcher"
                android:label="@string/app_name" android:theme="@style/MyTheme">
    ....
    
    
    @style/MyTheme.TextView
    
    styles.xml

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
         <style name="MyTheme" parent="android:style/Theme.NoTitleBar">
            <item name="android:textViewStyle">@style/MyTheme.TextView</item>
        </style>
    </resources>
    
     <?xml version="1.0" encoding="utf-8"?>
            <resources>
              <style name="MyTheme.Textview" parent="@android:style/TextAppearance">
                    <item name="android:textColor">#00FF00</item>
                </style>
            </resources>
    
    <application
                android:icon="@drawable/ic_launcher"
                android:label="@string/app_name" android:theme="@style/MyTheme">
    ....
    
    
    #00FF00
    
    AndroidManifest.xml

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
         <style name="MyTheme" parent="android:style/Theme.NoTitleBar">
            <item name="android:textViewStyle">@style/MyTheme.TextView</item>
        </style>
    </resources>
    
     <?xml version="1.0" encoding="utf-8"?>
            <resources>
              <style name="MyTheme.Textview" parent="@android:style/TextAppearance">
                    <item name="android:textColor">#00FF00</item>
                </style>
            </resources>
    
    <application
                android:icon="@drawable/ic_launcher"
                android:label="@string/app_name" android:theme="@style/MyTheme">
    ....
    
    
    ....
    
    我希望以上内容能对您有所帮助


    谢谢你

    我很确定这是一个打字错误,但你不是在写**对吗

    **android:theme="@style/GreenText"**
    
    另外,我不确定你是否能成为TextAppreance家长。试着不要那样

    还有一件事,你的申请在那之前有效吗?因为您正在使用活动的相对名称(“.LayoutsActivity”),并且应该使用完整的包名称

    您的XML正在编译吗?没有错误就很难调试