Posts

Showing posts from October, 2022

Jetpack Compose Modifier

Image
In this tutorial ( by Suraj Maity), we will learn about modifiers in Android Jetpack compose. This feature will help us to build some amazing UI easily. If you know Kotlin, it will be easy for you to build this kind of layout.  1. How to use the  modifier  to set the background, width, and fillMaxHeight? code: class MainActivity : ComponentActivity() { override fun onCreate (savedInstanceState: Bundle?) { super .onCreate(savedInstanceState) setContent { Column ( modifier = Modifier . background (Color. Yellow ) . fillMaxHeight ( 0.5f ) . width ( 900 . dp ) , horizontalAlignment = Alignment. CenterHorizontally , verticalArrangement = Arrangement. Center ) { Text ( text = "Hey Coders!" ) Text ( text = "Get.. Set.. CODE ->>>>>>>>>>>" ) } ...

Jetpack Compose Basics

Image
In this blog (by Suraj Maity), we will learn how to work with Jetpack compose to make the layout more easily. Using a few simple basic features, we will make the design more attractive. In Android, XML takes more code to make a layout and is a little hard compared to Jetpack compose. If you know XML, then it is okay to switch to Jetpack. But if you don't know then also no problem, we will learn from the beginning. 1. Create a simple Greeting using Jetpack Compose code: class MainActivity : ComponentActivity() { override fun onCreate (savedInstanceState: Bundle?) { super .onCreate(savedInstanceState) setContent { Greeting ( name = "Suraj" ) } } } @Composable fun Greeting (name: String){ Text ( text = "Hello $ name !" ) } @Preview (showBackground = true ) @Composable fun DefaultPreview (){ Jetpack1Theme { Greeting ( name = "Android" ) } } 2. Create a simple Greeting using Jetpack Comp...