Wednesday 25 November 2020

ContextWrapper override ContextThemeWrapper?

I have a confusing situation relate to context.

I was implement crowdin, this sdk make a "wrap" over the context for override the string.xml in runtime.

Crowdin.wrap(context) //ContextWrapper()

and works fine when dont wrapping the context, but when try to use MaterialAlertDialogBuilder with the context wrapped for crowdin the app crashed with the next exception.

android.view.InflateException: Binary XML file line #25 in com.example.app_user.user:layout/mtrl_alert_dialog: Binary XML file line #27: You must supply a layout_width attribute.
    Caused by: java.lang.UnsupportedOperationException: Binary XML file line #27: You must supply a layout_width attribute.

The file where not found the layout_width attribute is from Material Components.

I think that error is maybe cause because material first apply a ContextThemeWrapper and after crowdin apply a over the Context wrapped(ContextThemeWrapper)

enter image description here

  • Appcompat: 1.2.0
  • Material: 1.1.0

Post



from ContextWrapper override ContextThemeWrapper?

No comments:

Post a Comment