我有一個拒絕應用於活動的主題 - 沒有應用任何樣式。如果我不爲<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