Skip to content

Commit 4e06ce9

Browse files
TitleBar : single line marquee title
1 parent 8a21b87 commit 4e06ce9

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

  • compose-android/src/main/java/com/streamliners/compose/android/comp/appBar

compose-android/src/main/java/com/streamliners/compose/android/comp/appBar/TitleBar.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.streamliners.compose.android.comp.appBar
22

3+
import androidx.compose.foundation.ExperimentalFoundationApi
4+
import androidx.compose.foundation.basicMarquee
35
import androidx.compose.foundation.layout.PaddingValues
46
import androidx.compose.foundation.layout.RowScope
57
import androidx.compose.foundation.layout.fillMaxSize
@@ -38,7 +40,7 @@ fun TitleBarScaffold(
3840
}
3941
}
4042

41-
@OptIn(ExperimentalMaterial3Api::class)
43+
@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
4244
@Composable
4345
fun TitleBar(
4446
title: String,
@@ -48,7 +50,11 @@ fun TitleBar(
4850
) {
4951
TopAppBar(
5052
title = {
51-
Text(title)
53+
Text(
54+
modifier = Modifier.basicMarquee(),
55+
text = title,
56+
maxLines = 1
57+
)
5258
},
5359
navigationIcon = {
5460
navigationIcon?.invoke() ?:

0 commit comments

Comments
 (0)