Text(text = "Ellipsis", fontSize = 24.sp) Phasellus gravida massa laoreet ultrices porttitor." The "overflow" property val text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Visible (When overflow is visible, text may be rendered outside the bounds of the composable displaying the text).Ellipsis (Use an ellipsis to indicate that the text has overflowed.).Clip (Clip the overflowing text to fix its container.).By default, the following options are available: The overflow: TextOverflow property allows us to change the default behavior for visual overflow. TextDecoration = TextDecoration.Underline If we want to combine only two decorators, we can use the plus function: Text( In addition to this, we can combine multiple text decorators with the combine and plus functions. The textDecoration: TextDecoration? property allows us to paint decorations on top of the text. We will explore the AnnotatedString in the next section. The main difference between these two functions is the type of the "text" parameter ( text: String vs text: AnnotatedString). Style: TextStyle = LocalTextStyle.current OnTextLayout: (TextLayoutResult) -> Unit = , Overflow: TextOverflow = TextOverflow.Clip, LineHeight: TextUnit = TextUnit.Unspecified, LetterSpacing: TextUnit = TextUnit.Unspecified, Text(įontSize: TextUnit = TextUnit.Unspecified, Let us explore the signature of one of these functions and find the different parameters. We have two Text composable functions with different parameters. If you are already familiar with it, feel free to skip this section and move on to the next one. I want to start with an overview of the Text composable function along with a description and examples of the following properties: Demo of style Text with Jetpack Compose Introduction to the "Text" composable function The content of this article is based on the 1.0.0-rc02 version of Jetpack Compose. This article is a part of Jetpack Compose series: In this article, we will explore the possibilities of a Text composable function and how we can apply multiple styles to text with the AnnotatedString. Fortunately, we have many customization options for text with Jetpack Compose. Even if the application mostly shows media content, like images or video, the text is an essential part of any mobile application. Every mobile application shows a lot of text information on the screen.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |