setSupportActionBar

open fun setSupportActionBar(@Nullable toolbar: @Nullable Toolbar)(source)

Set a Toolbar to act as the androidx.appcompat.app.ActionBar for this Activity window.

When set to a non-null value the getActionBar method will return an androidx.appcompat.app.ActionBar object that can be used to control the given toolbar as if it were a traditional window decor action bar. The toolbar's menu will be populated with the Activity's options menu and the navigation button will be wired through the standard home menu select action.

In order to use a Toolbar within the Activity's window content the application must not request the window feature FEATURE_SUPPORT_ACTION_BAR.

Parameters

toolbar

Toolbar to set as the Activity's action bar, or null to clear it