Skip to main content

Configuration (Android)

The AlphaTabView is the entry point to alphaTab on Android. Every setting, event, and API call flows through the api property it exposes. This page walks through the four surfaces โ€” setup, settings, events, and API.

Setupโ€‹

Add the AlphaTabView to your layout and grab a reference to it in the activity. The installation page shows the full XML and Kotlin.

For non-UI backgrounds โ€” services, background workers, or custom controls โ€” use the low-level classes directly instead of the view. The Kotlin sources on GitHub show how the AlphaTabView is built and can be used as a reference for a bespoke wrapper.

Settingsโ€‹

The AlphaTabView exposes a settings property. Mutating it does not trigger a re-render automatically โ€” call api.updateSettings() to apply the changes:

alphaTabView.settings.display.layoutMode = LayoutMode.Page
alphaTabView.api.updateSettings()

The view also exposes a tracks property. Assign it to change which tracks are rendered.

The Settings reference documents every option.

Eventsโ€‹

Subscribe with .on(handler) and unsubscribe with .off(handler):

alphaTabView.api.playedBeatChanged.on { beat ->
updateFretboard(beat)
}

alphaTabView.api.scoreLoaded.on { score ->
Log.i("alphaTab", "Loaded: ${score.title}")
}

The API reference lists every event alphaTab exposes.

APIโ€‹

The high-level API is available on alphaTabView.api. Use it to load scores, drive playback, and query state:

alphaTabView.api.tex("\\title \"Hello alphaTab\" . 3.3*4")
alphaTabView.api.playPause()

See the full API reference for every method.