Custom Menu Items

Add custom menu items to the StreamLayer Element on Android. Use SLRCustomOverlay to register custom fragments in the StreamLayer menu with configurable position and visibility.

Custom Menu Items

You can add custom menu items to the StreamLayer Element on Android. Use the SLRCustomOverlay class to register your custom fragments. The class properties are:

  • actionId — navigation destination ID
  • titleId — string resource for the button title
  • iconId — drawable resource for the button image
  • fullClassName — full class name of the Fragment class (e.g., "io.streamlayer.demo.MainFragment")

Optionally, set the position in the bottom menu or hide the item using SLRCustomOverlay.position(Int) and SLRCustomOverlay.showOnBottomMenu(Boolean).

Register custom menu items through StreamLayer.addCustomOverlays():

StreamLayer.addCustomOverlays(arrayOf(
    SLRCustomOverlay(
        R.id.action_public_chat,
        R.string.public_chat,
        R.drawable.ic_public_chat,
        MainFragment::class.qualifiedName)
             .showOnBottomMenu(true)
             .position(3)
       )
)

Related