Android 测试ActionBar背景色
我开始对我的Android代码进行单元测试。然而,我面临着如何测试ActionBar背景的问题。我使用以下设置操作栏颜色:Android 测试ActionBar背景色,android,unit-testing,android-actionbar,Android,Unit Testing,Android Actionbar,我开始对我的Android代码进行单元测试。然而,我面临着如何测试ActionBar背景的问题。我使用以下设置操作栏颜色: <style name="AppBaseTheme" parent="android:Theme.Light"> <item name="android:actionBarStyle">@style/ActionBarTheme</item> </style> <!-- Application theme. -
<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>
那么,如何在代码中加载样式并检查背景颜色以便测试它呢?在应用程序清单中,确保您有android:theme=@style/AppBaseTheme
或者您决定命名自定义主题的任何内容 我问的是测试,而不是如何设置它!这是您加载它的方式。在清单中定义并运行应用程序。我想我不明白这个问题。