# LayoutInflater.Factory

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Factory

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/android/view/LayoutInflater.Factory "View this page in Java")  

```
interface Factory
```

|----------------------------------------------------------------------------------------------------------------------------|
| [android.view.LayoutInflater.Factory](https://developer.android.com/reference/kotlin/android/view/LayoutInflater.Factory#) |

|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Direct Subclasses [LayoutInflater.Factory2](https://developer.android.com/reference/kotlin/android/view/LayoutInflater.Factory2) |----------------------------------------------------------------------------------------------------------------|--------| | [LayoutInflater.Factory2](https://developer.android.com/reference/kotlin/android/view/LayoutInflater.Factory2) | <br /> | |

|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Indirect Subclasses [AccountAuthenticatorActivity](https://developer.android.com/reference/kotlin/android/accounts/AccountAuthenticatorActivity.html#), [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#), [ActivityGroup](https://developer.android.com/reference/kotlin/android/app/ActivityGroup.html#), [AliasActivity](https://developer.android.com/reference/kotlin/android/app/AliasActivity.html#), [ExpandableListActivity](https://developer.android.com/reference/kotlin/android/app/ExpandableListActivity.html#), [LauncherActivity](https://developer.android.com/reference/kotlin/android/app/LauncherActivity.html#), [ListActivity](https://developer.android.com/reference/kotlin/android/app/ListActivity.html#), [NativeActivity](https://developer.android.com/reference/kotlin/android/app/NativeActivity.html#), [PreferenceActivity](https://developer.android.com/reference/kotlin/android/preference/PreferenceActivity.html#), [TabActivity](https://developer.android.com/reference/kotlin/android/app/TabActivity.html#) |------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [AccountAuthenticatorActivity](https://developer.android.com/reference/kotlin/android/accounts/AccountAuthenticatorActivity.html#) | Base class for implementing an Activity that is used to help implement an AbstractAccountAuthenticator.                                                                                                                                                                                                                                                                                                                 | | [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)                                              | An activity is a single, focused thing that the user can do.                                                                                                                                                                                                                                                                                                                                                            | | [ActivityGroup](https://developer.android.com/reference/kotlin/android/app/ActivityGroup.html#)                                    | A screen that contains and runs multiple embedded activities.                                                                                                                                                                                                                                                                                                                                                           | | [AliasActivity](https://developer.android.com/reference/kotlin/android/app/AliasActivity.html#)                                    | Stub activity that launches another activity (and then finishes itself) based on information in its component's manifest meta-data.                                                                                                                                                                                                                                                                                     | | [ExpandableListActivity](https://developer.android.com/reference/kotlin/android/app/ExpandableListActivity.html#)                  | An activity that displays an expandable list of items by binding to a data source implementing the ExpandableListAdapter, and exposes event handlers when the user selects an item.                                                                                                                                                                                                                                     | | [LauncherActivity](https://developer.android.com/reference/kotlin/android/app/LauncherActivity.html#)                              | Displays a list of all activities which can be performed for a given intent.                                                                                                                                                                                                                                                                                                                                            | | [ListActivity](https://developer.android.com/reference/kotlin/android/app/ListActivity.html#)                                      | An activity that displays a list of items by binding to a data source such as an array or Cursor, and exposes event handlers when the user selects an item.                                                                                                                                                                                                                                                             | | [NativeActivity](https://developer.android.com/reference/kotlin/android/app/NativeActivity.html#)                                  | Convenience for implementing an activity that will be implemented purely in native code.                                                                                                                                                                                                                                                                                                                                | | [PreferenceActivity](https://developer.android.com/reference/kotlin/android/preference/PreferenceActivity.html#)                   | This is the base class for an activity to show a hierarchy of preferences to the user.                                                                                                                                                                                                                                                                                                                                  | | [TabActivity](https://developer.android.com/reference/kotlin/android/app/TabActivity.html#)                                        | For apps developing against [android.os.Build.VERSION_CODES#HONEYCOMB](https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#HONEYCOMB:kotlin.Int) or later, tabs are typically presented in the UI using the new [ActionBar.newTab()](https://developer.android.com/reference/kotlin/android/app/ActionBar.html#newTab()) and related APIs for placing tabs within their action bar area. | |

## Summary

|                                                                                                                                                                                                                                                                                                                           Public methods                                                                                                                                                                                                                                                                                                                           ||
|------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstract [View](https://developer.android.com/reference/kotlin/android/view/View)? | [onCreateView](https://developer.android.com/reference/kotlin/android/view/LayoutInflater.Factory#onCreateView(kotlin.String,%20android.content.Context,%20android.util.AttributeSet))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `context:` `[Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)`, `attrs:` `[AttributeSet](https://developer.android.com/reference/kotlin/android/util/AttributeSet.html#)`)` Hook you can supply that is called when inflating from a LayoutInflater. |

## Public methods

### onCreateView

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
abstract fun onCreateView(
    name: String, 
    context: Context, 
    attrs: AttributeSet
): View?
```

Hook you can supply that is called when inflating from a LayoutInflater. You can use this to customize the tag names available in your XML layout files.

Note that it is good practice to prefix these custom names with your package (i.e., com.coolcompany.apps) to avoid conflicts with system names.

|                                                                                       Parameters                                                                                       ||
|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name`    | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): Tag name to be inflated. This value cannot be `null`.                                     |
| `context` | [Context](https://developer.android.com/reference/kotlin/android/content/Context.html#): The context the view is being created in. This value cannot be `null`.             |
| `attrs`   | [AttributeSet](https://developer.android.com/reference/kotlin/android/util/AttributeSet.html#): Inflation attributes as specified in XML file. This value cannot be `null`. |

|                                                                  Return                                                                   ||
|---------------------------------------------------------------------------|----------------------------------------------------------------|
| [View](https://developer.android.com/reference/kotlin/android/view/View)? | View Newly created view. Return null for the default behavior. |