The second Android 11 Developer Preview is now available, test it out and share your feedback.

AppCompatViewInflater

open class AppCompatViewInflater
kotlin.Any
   ↳ androidx.appcompat.app.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.

Summary

Public constructors

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.

Protected methods

open AppCompatAutoCompleteTextView

open AppCompatButton
createButton(context: Context!, attrs: AttributeSet!)

open AppCompatCheckBox
createCheckBox(context: Context!, attrs: AttributeSet!)

open AppCompatCheckedTextView

open AppCompatEditText
createEditText(context: Context!, attrs: AttributeSet!)

open AppCompatImageButton
createImageButton(context: Context!, attrs: AttributeSet!)

open AppCompatImageView
createImageView(context: Context!, attrs: AttributeSet!)

open AppCompatMultiAutoCompleteTextView

open AppCompatRadioButton
createRadioButton(context: Context!, attrs: AttributeSet!)

open AppCompatRatingBar
createRatingBar(context: Context!, attrs: AttributeSet!)

open AppCompatSeekBar
createSeekBar(context: Context!, attrs: AttributeSet!)

open AppCompatSpinner
createSpinner(context: Context!, attrs: AttributeSet!)

open AppCompatTextView
createTextView(context: Context!, attrs: AttributeSet!)

open AppCompatToggleButton

open View?
createView(context: Context!, name: String!, attrs: AttributeSet!)

Public constructors

<init>

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.

Protected methods

createAutoCompleteTextView

@NonNull protected open fun createAutoCompleteTextView(
    context: Context!,
    attrs: AttributeSet!
): AppCompatAutoCompleteTextView

createButton

@NonNull protected open fun createButton(
    context: Context!,
    attrs: AttributeSet!
): AppCompatButton

createCheckBox

@NonNull protected open fun createCheckBox(
    context: Context!,
    attrs: AttributeSet!
): AppCompatCheckBox

createCheckedTextView

@NonNull protected open fun createCheckedTextView(
    context: Context!,
    attrs: AttributeSet!
): AppCompatCheckedTextView

createEditText

@NonNull protected open fun createEditText(
    context: Context!,
    attrs: AttributeSet!
): AppCompatEditText

createImageButton

@NonNull protected open fun createImageButton(
    context: Context!,
    attrs: AttributeSet!
): AppCompatImageButton

createImageView

@NonNull protected open fun createImageView(
    context: Context!,
    attrs: AttributeSet!
): AppCompatImageView

createMultiAutoCompleteTextView

@NonNull protected open fun createMultiAutoCompleteTextView(
    context: Context!,
    attrs: AttributeSet!
): AppCompatMultiAutoCompleteTextView

createRadioButton

@NonNull protected open fun createRadioButton(
    context: Context!,
    attrs: AttributeSet!
): AppCompatRadioButton

createRatingBar

@NonNull protected open fun createRatingBar(
    context: Context!,
    attrs: AttributeSet!
): AppCompatRatingBar

createSeekBar

@NonNull protected open fun createSeekBar(
    context: Context!,
    attrs: AttributeSet!
): AppCompatSeekBar

createSpinner

@NonNull protected open fun createSpinner(
    context: Context!,
    attrs: AttributeSet!
): AppCompatSpinner

createTextView

@NonNull protected open fun createTextView(
    context: Context!,
    attrs: AttributeSet!
): AppCompatTextView

createToggleButton

@NonNull protected open fun createToggleButton(
    context: Context!,
    attrs: AttributeSet!
): AppCompatToggleButton

createView

@Nullable protected open fun createView(
    context: Context!,
    name: String!,
    attrs: AttributeSet!
): View?