AppCompatViewInflater

This class is used by AppCompat to automatically "substitute" all usages of core Android widgets inflated from layout files by the AppCompat extensions of those widgets.

This class two main responsibilities: the first is to 'inject' our tinted views in place of the framework versions in layout inflation; the second is backport the android:theme functionality for any inflated widgets. This include theme inheritance from its parent.

In order to provide your own extensions, follow these steps:

  • Extend this class, or the relevant subclass if you're using the Material components library
  • Override one or more of the createXYZ methods
  • Add the viewInflaterClass attribute on your application theme. The value of the attribute should be the fully-qualified class name of your custom inflater class.

Inheritors

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
@Nullable
fun createView(@Nullable parent: @Nullable View, @NonNull name: @NonNull String, @NonNull context: @NonNull Context, @NonNull attrs: @NonNull AttributeSet, inheritContext: Boolean, readAndroidTheme: Boolean, readAppTheme: Boolean, wrapContext: Boolean): @Nullable View
Creates an AppCompat-compatible widget by automatically "substituting" all usages of core Android widgets with the AppCompat extensions of those widgets.