Search code examples
kotlinandroid-jetpack-composeandroid-appbarlayout

How to Get AppBarHeight from AppBar.kt in Compose Android


I want to get this value in AppBar.kt

private val AppBarHeight = 56.dp

I'm using the TopAppBar in a Scaffold and need to know its height, how can I retrieve this value without hard-coding it where I use it? I want to avoid declaring a dimen value for this if possible and measuring the UI element.


Solution

  • With a quick look at the code I don't think this is possible. So, the height of the AppBar is set like this: enter image description here

    but the `TopAppBar_Tokens are an internal object: enter image description here