Android Jetpack Compose using same elevation value - android

Hi, I want to migrate my apps to android jetpack compose and create custom card like this. But, when I try to using my trick on xml (using same elevation value) to create shadow around the card, I can't generate the same result.
How can this be achieved using jetpack compose?

Related

Android Jetpack Compose text that starts next to the image and continues below it

How can I make a design like the image with Jetpack Compose? I searched a lot, but I couldn't get any answer similar to the structure I wanted.
You can try out Romain's newest library
Composable widget for Jetpack Compose that allows to flow text around arbitrary shapes over multiple columns.
to achieve this and much more: https://github.com/romainguy/combo-breaker
How about using a simple Text only, but inside a Box where we can clip the size of the image using modifier!!
Box {
Image(modifier = modifier.clicp(RoundedCornerShape(...)))
Text(...)
}
modifier.clip(...) is something which can do the trick.
You can add Images inside text using AnnotatedString and inLineContent parameter of Text Composable
like How adding ImageSpan in jetpack compose Text
or you can use Box Composable and Clip your image using Modifier.clip(Shape)

Jetpack compose rememberSwipeableState is internal

i want to create a swipable component using jetpack compose and as the document Gestures | JetpackCompose I should use rememberSwipeableState.
but when I want to use it I face this error:
Cannot access 'rememberSwipeableState': it is internal in 'androidx.compose.material3'
what should I do?
This issue is already being tracked here, issue in Material3 Compose. Alternatively as per their recommendation
For the time being, we recommend forking Swipeable if you need it in
M3!
you can use Material2 Compose Swipeable and fork it.

How to support emoji in Android using Jetpack Compose

Just like the title, I found that emojis don't show up correctly in Jetpack Compose.
I'm going to make an offline app, so I'll use the emoji2-bundle or use the NotoColorEmoji font.
How to use the emoji2's component in Jetpack Compose (I tried using AndroidView(), but I don't know what arguments to pass in. Especially, the type of font's size in Androidview() is Float and not TextUnit(like .sp), I don't know how to convert it),
or get emojis in a String and use the NotoColorEmoji font in buildAnnotatedString{ ... }?

Shared element transition in Jetpack compose

I wanted to animate my image logo from Screen A to Screen B. In XML based layouts it was possible using windowContentTransitions & transitionName. So I wanted to ask is something similar available in Jetpack Compose?
I have already seen this https://github.com/mobnetic/compose-shared-element
But, Is there something in-built functionality similar to the XML?
Not supported yet by compose. See this conversation on kotlin-lang: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1616517641495500?thread_ts=1616516302.494300&cid=CJLTWPH7S

What is the equivalent approach of LayoutBuilder of Flutter in the Jetpack Compose?

An adaptive layout that is driven by the screen size. This is the basic idea and I use LayoutBuilderin the Flutter project, and how about in the Compose?
Checkout BoxWithConstraints.
It works very well.

Categories

Resources