- you can use relative layout as the parent and it will do the work
or
- get the actionbar and set the custom view manually with layout params to match parent
supportActionBar?.displayOptions = ActionBar.DISPLAY_SHOW_CUSTOM
val params = ActionBar.LayoutParams(
ActionBar.LayoutParams.MATCH_PARENT,
ActionBar.LayoutParams.MATCH_PARENT
)
supportActionBar?.setCustomView(customToolbarContent2, params)