简体   繁体   中英

Android creating themes and styles

I would like to define a theme for my first Android app. I use Eclipse and I follow this tutorial but have problems.

Steps:

A. I create the values/styles.xml file with content

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="default_splashScreen">
    <item name="android:background">@drawable/bg</item>
  </style>
</resources>

B. I create the values/themes.xml file with content

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="Theme" parent="android:Theme">
    <item name="SplashScreen">@style/default_splashScreen</item>
  </style>
</resources>

Now Eclipse always complains about the item name="SplashScreen" node with the message "No resource found...". I just want SplashScreen to call default_splashScreen style.

What is wrong? Thx!

Is Eclipse only complaining in the text editor or also when you actually try to compile and run the app? Maybe Eclipse doesn't update the project correctly - try one of the following:

  • have you set your project to 'Build automatically'?
  • tried a manual project refresh? (right click on project / refresh)
  • clean the project via Menu > Project Clean Project...
  • finally: restart Eclipse

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM