Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The icons in Jetpack Compose's Topbar can be removed by not specifying any icon parameter in the TopAppBar function. Here is an example:

import androidx.compose.material.*
import androidx.compose.runtime.*

@Composable
fun MyTopBar(title: String) {
    TopAppBar(
        title = { Text(text = title) },
        backgroundColor = MaterialTheme.colors.primary,
        elevation = 0.dp,
        navigationIcon = null, // No icon specified
        actions = {}
    )
}

In this example, the navigationIcon parameter is set to null indicating that the icon should not be displayed.