2014-03-26 188 views
0

我開始單元測試我的Android代碼。但是,我面臨着如何測試ActionBar背景的問題。我使用以下設置動作欄顏色:測試ActionBar背景顏色

<style name="AppBaseTheme" parent="android:Theme.Light"> 
    <item name="android:actionBarStyle">@style/ActionBarTheme</item> 
</style> 

<!-- Application theme. --> 
<style name="AppTheme" parent="AppBaseTheme"> 
    <!-- All customizations that are NOT specific to a particular API-level can go here. --> 
</style> 

<style name="ActionBarTheme" parent="@android:style/Widget.Holo.Light.ActionBar"> 
    <item name="android:background">@color/dark_green</item> 
</style> 

那麼,如何加載代碼中的樣式並檢查背景顏色,以便我可以測試它?

回答

0

在您的應用程序清單中,確保您有android:theme =「@ style/AppBaseTheme」 或者您決定命名您的自定義主題。

+0

我在問測試不怎麼設置! –

+0

這是你將如何加載它。在清單中定義它並運行應用程序。我想我不明白這個問題。 –

+0

我的意思是「單元測試」它。 TDD響鈴? –