使用 `?attr/` 时 ImageButton 的 Espresso InflateException
Espresso InflateException for ImageButton when using `?attr/`
我有一个ImageButton
这样的
<ImageButton
...
style="@style/buttonStyle" />
其中 buttonStyle
看起来像这样;
<style name="buttonStyle">
...
<item name="android:background">?attr/selectableItemBackgroundBorderless</item>
...
</style>
当这个 ImageButton
在 Espresso 测试中显示时,它会抛出
android.view.InflateException ... Error inflating class android.widget.ImageButton
当我删除 android:background
属性时,它工作正常。
关于 Espresso 测试的 Android 资源,我是否遗漏了什么?
请尝试使用相应主题的正确上下文。
我有一个ImageButton
这样的
<ImageButton
...
style="@style/buttonStyle" />
其中 buttonStyle
看起来像这样;
<style name="buttonStyle">
...
<item name="android:background">?attr/selectableItemBackgroundBorderless</item>
...
</style>
当这个 ImageButton
在 Espresso 测试中显示时,它会抛出
android.view.InflateException ... Error inflating class android.widget.ImageButton
当我删除 android:background
属性时,它工作正常。
关于 Espresso 测试的 Android 资源,我是否遗漏了什么?
请尝试使用相应主题的正确上下文。