我有一个拒绝应用于活动的主题 - 没有应用任何样式。如果我不为<Button>
提供layout_width
/layout_height
属性也得到一个运行时错误,表明没有被施加Button
类。未设置Android主题
/res/values/themes.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme" parent="android:style/Theme.Black">
<item name="android:windowNoTitle">true</item>
<item name="android:buttonStyle">@style/Button</item>
<item name="android:windowBackground">@color/page_background_light</item>
<item name="android:textAppearance">@style/TextAppearance</item>
</style>
</resources>
/res/values/styles.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="TextAppearance" parent="@android:style/TextAppearance">
<item name="android:textSize">12sp</item>
<item name="android:textColor">@color/darkblue</item>
</style>
<style name="Button" parent="@android:style/Widget.Button">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<!--<item name="android:textColor">#3C2F4F</item>
<item name="android:textSize">20dip</item>-->
</style>
</resources>
和相关舱单:
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/Theme">
我错过了什么明显的错误?
我正在处理完全相同的问题。你确定你可以把主题放在单独的文件中吗?我试图设置主题为活动(而不是应用程序),我也尝试应用程序onStart - 没有运气... – katit 2011-05-24 18:00:01
嗯。我认为我们有更大的问题。我试图从父=“android:Theme.Light.NoTitleBar.Fullscreen”继承,我得到了我的活动全屏。但我的按钮和ListView样式仍然没有应用..所以,它似乎是主题“应用”,但不是所有的内部项目 – katit 2011-05-24 18:19:23