vendredi 15 décembre 2017

Writing android tests for custom layouts that extend design library layouts

I'm trying to test a custom layout, which extends TextInputLayout from the design library. When i run the test, i get the error

java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library. at android.support.design.widget.ThemeUtils.checkAppCompatTheme(ThemeUtils.java:33) at android.support.design.widget.TextInputLayout.(TextInputLayout.java:192) at android.support.design.widget.TextInputLayout.(TextInputLayout.java:185) at android.support.design.widget.TextInputLayout.(TextInputLayout.java:181)

I'm using the context provided by InstrumentationRegistry.getTargetContext() to instantiate the custom layout. How do I fix this?

Aucun commentaire:

Enregistrer un commentaire