How to support emoji in Android using Jetpack Compose - android

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{ ... }?

Related

Android Jetpack Compose using same elevation value

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?

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)

is it possible to use both androidx.compose.material3.MaterialTheme & androidx.compose.material.MaterialTheme in Android application

I am investigating Android Jetpack Compose in my current Android application.
I wish to have the main screen contain a backdrop and show selected options on the front layer.
I also require my application to support Dark Mode.
It seems to me that I must employ both androidx.compose.material3.MaterialTheme & androidx.compose.material.MaterialTheme to theme my application.
This is because androidx.compose.material.BackdropScaffold is a material component, which means it ignores my androidx.compose.material3.MaterialTheme values.
however i would like my application to take advantage of Material components as much as possible.
Is it possible to configure multiple MaterialTheme(s) in this case?
Do I have to wait for a Material3 version of BackdropScaffold?
It will be Challenging! I am guessing you are using Android & NOT Compose
There is Not a direct correlation between the androidx.compose.material3.Typography
also Material 3 ColorScheme is much extended, to make te colors work you will need to defind the colors to match, well those that can, and make use you import the correct library when using the MaterialTheme Libraries
Otherwise I see no reason why not to try migrate as material 3 comes to maturity!
My Compose/Material3 App have similar roblems because they disabled support for rememberScaffoldState() in the Scaffold, I had to implement that myself as seperate DrawerState and SnackbarHostState

Is there a way to set auto refresh the jetpack compose preview?

I just started to use the Jetpack compose toolkit. I added the #Preview and a set showBackground = true, showSystemUi = true as parameters and it works really good. But every time i add or change something it doesn't auto refresh by itself, so i have to do it manually.
as Raul text, padding and some other things update automatically, but **
make sure you have live edit of literals on
**.
But soon Live edit of composables, not just literals (Int, String, Dp...) will be available, :
read more here
for the static resources like text, color the UI updates automatically, as it does on the running application, but for the structural components you need to rebuild the project and the changes apply automatically in the preview as well.
Some Components auto-refresh on version 1.1.1

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

Categories

Resources