2013-04-12 18 views
0

我知道文本外觀在此之前已經被問過很多次了,但是我在使它正常工作時遇到問題。下面顯示的是主題xml以及文本視圖樣式xml。主題AppTheme應用於清單文件中。如何讓文本外觀在應用程序主題中工作

我遇到的問題是沒有應用textview樣式。我期待它以類似於android:buttonStyle的方式工作。

有誰知道什麼可能導致此問題?

謝謝

主題XML

<style name="AppBaseTheme" parent="android:Theme.Holo"> 

</style> 

<style name="AppTheme" parent="AppBaseTheme"> 

    <item name="android:windowBackground">@drawable/backgroundmain</item> 
    <item name="android:buttonStyle">@style/button_main</item> 
    <item name="android:textAppearance">@style/textview_main</item> 

</style> 

TextView的風格XML

<style name="textview_main"> 

    <item name="android:textColor">@color/Snow</item> 
    <item name="android:textSize">16sp</item> 

</style> 

回答

0

您可以通過如下XML佈局應用它:

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="@string/hello_world" 
    android:textAppearance="@style/textview_main" 
    /> 

希望能幫到你。

+0

嗨,有幫助。但是,我試圖將它作爲整個應用程序的主題而不是每個視圖應用。謝謝 – user2059311

相關問題