我创建了一个简单的用户名/密码对话框,我想要应用主题(它基本上定义windowBackground
),并且还要在Eclipse
中进行预览。
我看到我的主题在主题组合框中的其他主题中显示,但选择它会产生以下错误:
Missing styles. Is the correct theme chosen for this layout?
Use the Theme combo box above the layout to choose a different layout, or fix the theme style references.
Failed to find style 'textViewStyle' in current theme
android.content.res.Resources$NotFoundException
Couldn't find theme resource attr/textAppearanceLarge for the current theme
Exception details are logged in Window > Show View > Error Log
The following classes could not be found:
- TextView (Change to android.widget.TextView, Fix Build Path, Edit XML)
主题定义:
<style name="my_theme">
<item name="android:windowBackground">@drawable/form_header</item>
<!-- <item name="android:padding">0dp</item>-->
<item name="android:windowNoTitle">true</item>
</style>
调试工作正常。然而,所见即所得更加明显。
答案 0 :(得分:45)
在编辑器中首先关闭布局文件,然后重新启动Eclipse。
答案 1 :(得分:24)
我也遇到了这个问题。 我通过改变主题来解决它。 这样做的步骤
答案 2 :(得分:5)
您应该在图形布局中选择另一个主题(例如:默认主题)。我认为你的自定义主题不支持某些属性。
答案 3 :(得分:3)
确保您在不同值下显示的所有其他styles.xml包含您的自定义主题部分。
我有类似的问题。
在我的情况下,我在res下的values-large文件夹中添加了一个自定义主题。它在运行时工作,但在eclipse中给出错误。
所以我尝试在所有其他styles.xml文件中添加自定义部分(在我的情况下,总共有3个标签添加到styles.xml文件中)。即values-normal-hdpi
,values-normal-mdpi
,valuse-v11
和values-v14
下的styles.xml文件......
和BOOM !!!它解决了我整天浪费的问题。