2012-01-02 64 views
0

添加主題,我創建了一個主題,並把它的值類別:在android系統不工作

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

//我的清單文件

<?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!?!? 
+0

你有什麼錯誤? – 2012-01-02 07:04:36

回答

0

爲了讓你必須創建以下文件的主題。

  1. 價值觀文件夾的themes.xml
  2. styles.xml價值觀夾
  3. 在AndroidManifest.xml
  4. 應用主題

的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

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

AndroidManifest.xml中

<application 
      android:icon="@drawable/ic_launcher" 
      android:label="@string/app_name" android:theme="@style/MyTheme"> 
.... 

我希望以上內容可以幫助你。

謝謝

+0

感謝它的幫助 – BlackFire27 2012-01-02 07:44:52

0

我敢肯定這是一個錯字,但你實際上並沒有寫**吧?

**android:theme="@style/GreenText"** 

此外,我不確定您可以使TextAppereance父。嘗試沒有。

另一件事,是你的應用程序在那之前工作?因爲您正在使用活動的相對名稱(「.LayoutsActivity」),所以應該使用完整的軟件包名稱。

您的XML是否正在編譯?很難調試沒有錯誤。