Разделитель в композиционном материале 3Android

Форум для тех, кто программирует под Android
Ответить
Anonymous
 Разделитель в композиционном материале 3

Сообщение Anonymous »


I want to add a horizontal divider below the top bar like this:


Изображение


I am using Material 3. but the Divider can not be resolved. here are my dependencies:

dependencies { implementation 'androidx.core:core-ktx:1.7.0' implementation "androidx.compose.ui:ui:$compose_version" implementation 'androidx.compose.material3:material3:1.0.0-alpha01' implementation "androidx.compose.ui:ui-tooling-preview:$compose_version" implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1' implementation 'androidx.activity:activity-compose:1.3.1' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version" debugImplementation "androidx.compose.ui:ui-tooling:$compose_version" debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version" } And here are my codes:

Scaffold( topBar = { SmallTopAppBar( navigationIcon = { IconButton( onClick = {}) { Icon( imageVector = Icons.Default.ArrowBack, contentDescription = "Back", tint = Color.Black ) } }, title = { Text( text = "", color = MaterialTheme.colorScheme.onPrimary ) }, ) } ) { Box { Divider(color = Color.Gray, thickness = 1.dp) } } But as I mentioned above Divider is the unresolved reference:


Изображение



Источник: https://stackoverflow.com/questions/731 ... material-3
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»