2014-03-26 135 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响铃? –