![]() ![]() You may have noticed that each of these is nullable, with a default value of null – this means that you only need to provide the attributes that you want to style. Val textGeometricTransform: TextGeometricTransform? = null, Val baselineShift: BaselineShift? = null, Val fontSynthesis: FontSynthesis? = null, As we can see below, there are a collection of different properties that we can set here: data class TextStyle( When it comes to defining the style attribute for the text component, we need to use an instance of the TextStyle class. SelectionColor – an androidx.ui.graphics.Color reference used for the styling of the component when the text is selected We’ll cover this in depth in the next section below TextStyle – an androidx.ui.text.TextStyle reference used to declare the different attributes used for styling the text. ParagraphStyle – an androidx.ui.text.ParagraphStyle reference used to declare the different attributes for styling paragraphs. ![]() For example, let’s take some text without any customisation: Using the Text component out of the box does not require too much from our side if we just want to display some text on screen. SelectionColor: Color = DefaultSelectionColor Overflow: TextOverflow = DefaultOverflow, This component provides us with a collection of attributes to control the appearance of our text. When it comes to text, we have a Composable Text component located in the androidx.ui.core package. In this article we’re going to start with the Text component, something that we’re likely to use in most of our applications. In this series of articles I want to dive into each of the components that are available, exploring how we can utilise each of them within our applications. To get started with jetpack compose, there is a great tutorial on the official developer site. Within Android Studio 4.0 Canary 1 we can start exploring Jetpack compose, a new way to build the UI for your android applications in a declarative manner. ![]()
0 Comments
Leave a Reply. |