AppCompatViewInflater
class AppCompatViewInflater
LeanbackAppCompatViewInflater |
Inflater that converts leanback non-AppCpmpat views in layout to AppCompat versions. |
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
createXYZmethods - Add the
viewInflaterClassattribute on your application theme. The value of the attribute should be the fully-qualified class name of your custom inflater class.
Summary
Public constructors |
|---|
Public functions |
|
|---|---|
View? |
createView(Creates an AppCompat-compatible widget by automatically "substituting" all usages of core Android widgets with the AppCompat extensions of those widgets. |
Public constructors
Public functions
createView
fun createView(
parent: View?,
name: String,
context: Context,
attrs: AttributeSet,
inheritContext: Boolean,
readAndroidTheme: Boolean,
readAppTheme: Boolean,
wrapContext: Boolean
): View?
Creates an AppCompat-compatible widget by automatically "substituting" all usages of core Android widgets with the AppCompat extensions of those widgets.
Most developers should not call this method directly. Instead, use the layout inflater provided by getLayoutInflater or call createView.
| Parameters | |
|---|---|
parent: View? |
the hierarchical parent of the view, if any |
name: String |
class name of the view, must be a simple class name like |
context: Context |
context against which the view should be constructed, may be wrapped for theming purposes or fully replaced if |
attrs: AttributeSet |
attribute set to pass to the view constructor |
inheritContext: Boolean |
|
readAndroidTheme: Boolean |
|
readAppTheme: Boolean |
|
wrapContext: Boolean |
|
| Returns | |
|---|---|
View? |
an AppCompat-compatible widget |
Protected functions
createAutoCompleteTextView
protected fun createAutoCompleteTextView(context: Context!, attrs: AttributeSet!): AppCompatAutoCompleteTextView
createButton
protected fun createButton(context: Context!, attrs: AttributeSet!): AppCompatButton
createCheckBox
protected fun createCheckBox(context: Context!, attrs: AttributeSet!): AppCompatCheckBox
createCheckedTextView
protected fun createCheckedTextView(context: Context!, attrs: AttributeSet!): AppCompatCheckedTextView
createEditText
protected fun createEditText(context: Context!, attrs: AttributeSet!): AppCompatEditText
createImageButton
protected fun createImageButton(context: Context!, attrs: AttributeSet!): AppCompatImageButton
createImageView
protected fun createImageView(context: Context!, attrs: AttributeSet!): AppCompatImageView
createMultiAutoCompleteTextView
protected fun createMultiAutoCompleteTextView(context: Context!, attrs: AttributeSet!): AppCompatMultiAutoCompleteTextView
createRadioButton
protected fun createRadioButton(context: Context!, attrs: AttributeSet!): AppCompatRadioButton
createRatingBar
protected fun createRatingBar(context: Context!, attrs: AttributeSet!): AppCompatRatingBar
createSeekBar
protected fun createSeekBar(context: Context!, attrs: AttributeSet!): AppCompatSeekBar
createSpinner
protected fun createSpinner(context: Context!, attrs: AttributeSet!): AppCompatSpinner
createTextView
protected fun createTextView(context: Context!, attrs: AttributeSet!): AppCompatTextView
createToggleButton
protected fun createToggleButton(context: Context!, attrs: AttributeSet!): AppCompatToggleButton
createView
protected fun createView(context: Context!, name: String!, attrs: AttributeSet!): View?