Ask Your Question
3

How can the icons in Jetpack Compose's Topbar be removed?

asked 2023-03-13 11:00:00 +0000

pufferfish gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-01-31 15:00:00 +0000

lakamha gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-03-13 11:00:00 +0000

Seen: 18 times

Last updated: Jan 31 '22