定义自己的Android主题时遇到的问题
这个XML有什么问题吗?我没有得到任何编译时错误,但每当我试图编辑它时,Eclipse都会给我一个nullpointerexception。为什么? /res/values/styles.xml定义自己的Android主题时遇到的问题,android,xml,themes,Android,Xml,Themes,这个XML有什么问题吗?我没有得到任何编译时错误,但每当我试图编辑它时,Eclipse都会给我一个nullpointerexception。为什么? /res/values/styles.xml <?xml version="1.0" encoding="utf-8"?> <resources> <!-- Base application theme is the default theme. --> <style nam
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme is the default theme. -->
<style name="Theme" parent="android:Theme">
</style>
<!-- Variation on our application theme that has a translucent
background. -->
<style name="Theme.Translucent">
<item name="android:windowBackground">@drawable/translucent_background</item>
<item name="android:windowNoTitle">true</item>
<item name="android:colorForeground">#fff</item>
</style>
<!-- Variation on our application theme that has a transparent
background; this example completely removes the background,
allowing the activity to decide how to composite. -->
<style name="Theme.Transparent">
<item name="android:windowBackground">@drawable/transparent_background</item>
<item name="android:windowNoTitle">true</item>
<item name="android:colorForeground">#fff</item>
</style>
<style name="TextAppearance.Theme.PlainText" parent="android:TextAppearance.Theme">
<item name="android:textStyle">normal</item>
</style>
</resources>
@可绘制/半透明背景
真的
#fff
@可绘制/透明背景
真的
#fff
正常的
没有任何东西会立即出现在我面前,只要确保您的res/drawable
文件夹中有透明背景
和半透明背景
。我也看过几次。我做了一个项目->清理,然后重新启动了eclipse。当它再次出现时,问题就消失了。通常,当Eclipse弹出消息时,您可以将其拖到一边,而不是关闭它,让它再次发生。或者,尝试使用非Android编辑器或纯文本编辑器在Eclipse中编辑XML文件。您应该将您的评论作为答案发布,这样我就可以核对:)