我想制作一个自定义通知视图,其中的内容会定期更新。自定义视图可能包含操作按钮。在android文档中,我们可以使用XML布局文档创建自定义视图:https://developer.android.com/training/notify-user/custom-notification
// Get the layouts to use in the custom notification
val notificationLayout = RemoteViews(packageName, R.layout.notification_small)
val notificationLayoutExpanded = RemoteViews(packageName, R.layout.notification_large)
// Apply the layouts to the notification
val customNotification = NotificationCompat.Builder(context, CHANNEL_ID)
.setSmallIcon(R.drawable.notification_icon)
.setStyle(NotificationCompat.DecoratedCustomViewStyle())
.setCustomContentView(notificationLayout)
.setCustomBigContentView(notificationLayoutExpanded)
.build()
Run Code Online (Sandbox Code Playgroud)
那么我们可以使用 jetpack compose 制作自己的自定义通知视图吗?
android android-layout android-notifications android-view android-jetpack-compose
我想将自定义下划线样式应用于带下划线的文本。我们可以在里面改变吗TextDecoration.underline?
textStyle = MaterialTheme.typography.titleMedium.copy(
textAlign = TextAlign.Start,
fontWeight = FontWeight.W600,
color = color,
textDecoration = TextDecoration.Underline
)
Run Code Online (Sandbox Code Playgroud) 我想用数字显示文本,我想要实现的是在显示文本时为该文本设置动画。动画是应该将计数器从零增加到目标值。我尝试使用animateIntAsState但它不起作用。
这就是我累的状态:
val daysCounter by animateIntAsState(
targetValue = days ,
animationSpec = tween(
durationMillis = 5000,
easing = FastOutSlowInEasing
)
)
Run Code Online (Sandbox Code Playgroud)
和文字:
Text(
text = "$daysCounter",
fontSize = 40.sp,
color = MaterialTheme.colors.onPrimary,
fontWeight = FontWeight.Bold
)
Run Code Online (Sandbox Code Playgroud) android android-jetpack-compose android-jetpack-compose-text jetpack-compose-animation
使用Jetpack Compose Text()时,我无法更改fontWeightmore thanFontWeight.W600和FontWeight.W500. 除了这两个之外,没有像 、 等应用FontWeight.W700。FontWeight.Bold我FontWeight(550)试图创建太暗的文本,但根本无法实现。注意:我使用的是来自谷歌可下载字体的Roboto字体和.material theme 3
One example of text code:-
Text(
modifier = Modifier.padding(top = 4.dp),
text = "This should be too bold",
style = MaterialTheme.typography.titleSmall,
fontWeight = FontWeight.Black,
)
Run Code Online (Sandbox Code Playgroud) 在以前的材料版本中,我们确实喜欢:-
ModalBottomSheetLayout(sheetContent = ) {
}
Run Code Online (Sandbox Code Playgroud) android android-jetpack-compose android-bottomsheetdialog android-jetpack-compose-material3
我们可以创建自己的custom rememberState喜欢的吗rememberModalButtomSheetSTate()?另外,我想将可组合项存储在 RememberState 中,并能够使用此状态设置和访问可组合项。喜欢rememberState.setCompose = @Composable和rememberState.getComposable
我需要用户当前位置的latitude,来相应地显示帖子,我正在使用 next.js 任何人都可以帮助我吗?longitude
android ×6
android-jetpack-compose-material3 ×1
android-jetpack-compose-text ×1
android-view ×1
geolocation ×1
next.js ×1
reactjs ×1
userlocation ×1