Android创建主题和样式

时间:2010-07-26 22:26:27

标签: android eclipse themes styles styling

我想为我的第一个Android应用定义一个主题。我使用Eclipse并且我遵循this tutorial但是有问题。

步骤:

一个。我使用内容

创建values / styles.xml文件
<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="default_splashScreen">
    <item name="android:background">@drawable/bg</item>
  </style>
</resources>

B中。我使用内容

创建values / themes.xml文件
<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="Theme" parent="android:Theme">
    <item name="SplashScreen">@style/default_splashScreen</item>
  </style>
</resources>

现在,Eclipse总是抱怨项目名称=“SplashScreen”节点,并显示消息“找不到资源...”。我只是想让SplashScreen调用default_splashScreen样式。

有什么问题? THX!

1 个答案:

答案 0 :(得分:1)

Eclipse只是在文本编辑器中抱怨,还是在你真正尝试编译和运行应用程序时?也许Eclipse没有正确更新项目 - 请尝试以下方法之一:

  • 您是否已将项目设置为“自动构建”?
  • 试过手动项目刷新? (右键单击项目/刷新)
  • 通过菜单清除项目&gt;项目清洁项目......
  • 终于:重启Eclipse