Виталий Перятин
03/31/2022, 4:23 PMImage
with a vector image as a background. When scrolling through the list on a physical Pixel 3, strong lags are observed (everything is ok on emulators). Moreover, if I replace Image
with Canvas
and draw images manually through Canvas, then there are no lags when scrolling. Lags are observed in both debug and release versions.
Tell me please how to fix the lags?enighma
03/31/2022, 6:13 PMLazyVerticalGrid
and I want to have a fixed number of columns but I don’t want it to take all available vertical size. Is there a way to have it wrap on the width?
I tried providing modifier = Modifier.wrapContentWidth()
but it’s still taking all available widthenighma
03/31/2022, 11:36 PMAndroid75
04/01/2022, 3:34 AMBox(modifier = Modifier
.fillMaxSize()
.background(BlueDentPad), contentAlignment = Alignment.Center) {
Image(
painter = painterResource(id = R.drawable.logo), contentDescription = null,
contentScale = ContentScale.FillWidth,
modifier = Modifier
.padding(10.dp)
)
}
Box(modifier = Modifier
.fillMaxSize().padding(10.dp), contentAlignment = Alignment.BottomCenter) {
Text(text = "Company © 2022", color = Color.White, textAlign = TextAlign.Center)
}
ildar.i [Android]
04/01/2022, 6:44 AMwintersoldier
04/01/2022, 2:00 PM@Composable
fun CustomTextViewCompose(
customText: String
) {
Text(text = customText)
}
--------------------------------
class CustomTextView(
context: Context,
attrs: AttributeSet? = null,
defStyle: Int = 0
) : AbstractComposeView(context, attrs, defStyle) {
var textString by mutableStateOf("")
@Composable
override fun Content() {
CustomTextViewCompose(customText = textString)
}
}
This is a very pretty basic sample , when it comes to button and all you may have to update the text and do other things to , how to handle those scenarious?julioromano
04/01/2022, 2:03 PMkeyboardType = KeyboardType.Number
set) I can see the on screen keyboard briefly switching back to KeyboardType.Text
and then re-switch to KeyboardType.Number
. It doesn’t happens always. Please see video.
Any idea on how to avoid this unnecessary keyboard “flickering”?nuhkoca
04/01/2022, 8:12 PMTopBar
using a Box
as I needed Scroll-To-Fade animation but icon click is not working as efficient as TopBar
. In Compose’s TopBar
, touch target area is working well for navigation and action items as long as you touch within the boundaries of the blue square. Therefore, IconButton
successfully delegates click action to Icon
component but in my custom TopBar
, click behavior is not working as in Compose’s TopBar
. if I only touch within the boundaries of the red square, I am seeing ripple. How do I fix that? Thank you.karn
04/02/2022, 12:11 AMShakil Karim
04/02/2022, 8:02 AMjava.lang.IllegalStateException: Already attached to lifecycleOwner
Crash when navigating back
i am using navigation-compose:2.5.0-alpha02, is it a known issue?Alexander Maryanovsky
04/02/2022, 11:07 AMforEach
for @Composable
functions?zalewski.se
04/02/2022, 2:30 PMTolriq
04/02/2022, 5:56 PMval animatedColor by animateColorAsState(
if (isPlaying) Color.Transparent else MaterialTheme.colorScheme.surface,
)
myanmarking
04/02/2022, 6:53 PMIcyrockton
04/03/2022, 4:57 AMAndroid75
04/03/2022, 5:24 AMColumn(modifier = Modifier.fillMaxSize().padding(10.dp)) {
WPToolBar("Grid", textColor = Color.Blue, showBack = true)
Spacer16()
Row(
modifier = Modifier.fillMaxWidth().weight(1f)) {
Box(modifier = Modifier.weight(1f).fillMaxHeight()) {
CardCell()
}
Box(modifier = Modifier.weight(1f).fillMaxHeight()) {
CardCell()
}
}
Row(
modifier = Modifier.fillMaxWidth().weight(1f)) {
Box(modifier = Modifier.weight(1f).fillMaxHeight()) {
CardCell()
}
Box(modifier = Modifier.weight(1f).fillMaxHeight()) {
CardCell()
}
}
}
@Composable
fun CardCell() {
Card(elevation = 4.dp, shape = RoundedCornerShape(20.dp) ,modifier = Modifier.fillMaxSize().padding(10.dp)) {
Image(
contentScale = ContentScale.Fit,
contentDescription = null,
painter = painterResource(id = R.drawable.preview2)
)
}
}
nuhkoca
04/03/2022, 6:34 AMLoadingView
that should be centered on the screen but BoxScope
is not working if I use CrossFade
animation. It always appears on the left hand corner by default. However, if I do not wrap `Composable`s into CrossFade
, it is working as expected. Somehow LoadingView
is losing BoxScope
. What should I do?
Box(
modifier = Modifier
.fillMaxSize()
.padding(it)
.verticalScroll(scrollState)
) {
Crossfade(targetState = collectionState) { state ->
when (state) {
CollectionState.Loading -> LoadingView()
...
}
}
}
@Composable
private fun BoxScope.LoadingView() {
Box(modifier = Modifier.align(Alignment.Center)) {
TRCircularProgressIndicator()
}
}
Omar
04/03/2022, 7:02 AMPasswordVisualTransformation()
in TextField
so that user can see what he writes for a while. Like in this videoGordon
04/03/2022, 8:20 AMval currentAnimValue = remember { Animatable(0f) }
//if i put this inside my dragEnd i get: Composable invocations can only happen from the context of a @Composable function
LaunchedEffect(value) {
currentAnimValue.animateTo(value)
}
And if i do it, on function start, I can't set the current value, so the animation goes from initial value(0f in this case) not the current dragged value
Slackbot
04/03/2022, 9:22 AMMehdi Haghgoo
04/03/2022, 9:13 PMAndroid75
04/04/2022, 2:37 AMfun NavigationComponent(navController: NavHostController) {
NavHost(
navController = navController,
startDestination = Destination.Splash.path
) {
composable(Destination.Splash.path) {
Log.i("test"," Splash screen" )
SplashScreen(navController)
}
composable(Destination.Dashboard.path) {
Log.i("test"," Dashboard screen" )
DashboardScreen(navController)
}
composable(Destination.SectionPage.path+"/{type}") {backStackEntry ->
Log.i("test"," Sectionpage screen" )
SectionPage(navController, backStackEntry.arguments?.getString("type"))
}
}
}
I send navController to page.
@Composable
fun SplashScreen(navController: NavHostController?) {
val viewModel: SplashViewModel= viewModel()
viewModel.setNavigationController(navController )
I save navController inside ViewModel so i can change page. it works but navigate call screen 2 o 3 time.. i have this log
I: Splash screen
I: Splash screen
I: Splash screen
I: Dashboard screen
I: Dashboard screenAndroid75
04/04/2022, 2:41 AMcomposable(Destination.Splash.path) {
Log.i("test"," Splash screen" )
SplashScreen(navController)
}
Can Korkmaz
04/04/2022, 7:45 AMabbic
04/04/2022, 8:55 AMthanh
04/04/2022, 11:10 AM1.6.20
? I see this error with Kotlin 1.6.20
and kotlinCompilerExtensionVersion '1.1.1'
java.lang.NoSuchMethodError: 'org.jetbrains.kotlin.ir.expressions.impl.IrSetFieldImpl org.jetbrains.kotlin.ir.builders.ExpressionHelpersKt.irSetField(org.jetbrains.kotlin.ir.builders.IrBuilderWithScope, org.jetbrains.kotlin.ir.expressions.IrExpression, org.jetbrains.kotlin.ir.declarations.IrField, org.jetbrains.kotlin.ir.expressions.IrExpression)'
at androidx.compose.compiler.plugins.kotlin.lower.LiveLiteralTransformer.irLiveLiteralGetter(LiveLiteralTransformer.kt:318)
at androidx.compose.compiler.plugins.kotlin.lower.LiveLiteralTransformer.visitConst(LiveLiteralTransformer.kt:439)
Vsevolod Kaganovych
04/04/2022, 11:20 AMAnimatedVisibility
execution? Code in thread.esdrasdl
04/04/2022, 1:09 PMfun stop(lambda)
. The animation continues until someone call stop(). When it happens, the animation continues until it reaches the initial drawable positions and then it executes the lambda function.
In my opinion, the issue is how to continue the animation after a recomposition when the composable state changes.
I tried to follow the chart in the docs but I’m no sure which API should I use.Scott Peterson
04/04/2022, 1:49 PMdimsuz
04/04/2022, 3:19 PMLayout
in compose, is it OK to measure a measurable and then not .place
it? (for example if no space) Or is it better to place it but with 0 height?dimsuz
04/04/2022, 3:19 PMLayout
in compose, is it OK to measure a measurable and then not .place
it? (for example if no space) Or is it better to place it but with 0 height?Albert Chang
04/04/2022, 3:24 PM