Sign in
Log inSign up

Jetpack Compose Tutorial - Android Launched new Library Jetpack Compose

rrtutors's photo
rrtutors
·Jan 15, 2022·

4 min read

Jetpack Compose Tutorial : Google announced Jetpack Compose at I/O 2019. Compose is a declarative UI framework. Compose is replacement for view based android system which will be a part of android beginning.

Here we have created so many compose examples with Android studio for beginners who knows android and want to start with Compose tutorial

What is Composable?

Composable are the main building blocks of Jetpack Compose. A composable functions are normal kotlin functions by adding an annotation @Composable By seeing the composable function we thought that it takes an input and return something as output, but internally an action registered to add the element to the in-memory representation of the composable tree. The registered actions are called 'emmiting'

Properties of composable functions

Calling Context

Any funcitons which is annotated with @Composable can be transulated by Jetpack Compose compiler to a function which implicitly gets passed an instance of Composable context as parameter and this instance of context will also be farwards to its children inside that composable tree

    @Composable
fun DisplayName(name: String, sirname: String) {
    Column(modifier = Modifier.padding(16.dp)) {
    Text(text = name)
    Text(text = sirname, style = MaterialTheme.typography.subtitle2)
    }
}

Let's take a simple function with @Composable annotation, for this composable function jetpack compose compiler will add Composable parameter implicitly for each composable call on composable tree

So this will be internally looks like below

 fun DisplayName(name: String, sirname: String, $composer: Composer<*>) {
$composer.start(111)
Column(modifier = Modifier.padding(16.dp), $composer) {
        Text(
            text = name,
            $composer
        )
        Text(
            text = sirname,
            style = MaterialTheme.typography.subtitle2,
             $composer
        )
    }
        $composer.end()
 }

List of Jetpack Compose UI Component examples

How to Create Jetpack Compose project with Android studio How to create Jetpack compose textfield How to create checkbox with Jetpack compose? How to set Text Color, Size and style with Compose? How to set Button height and width with Jetpack Compose? How to Load Html page with Jetpack compose Webview Create Toast with Jetpack Compose Make Text Spannable using Jetpack Compose - Text Selection Download image from URL using Jetpack Compose How to create radio buttons with jetpack compose? How to show progress bar with jetpack compose? How to Create Card with Jetpack Compose? How to create Row Layout with Jetpack Compose? How to create Column Layout with Jetpack Compose? Compose Imageview - How to show Image in Imageview How to create circular imageview with Jetpack compose? How to make Image transparency with jetpack compose? How to show Jetpack compose alert dialog? How to show date picker with Jetpack compose? Compose Recyclerview - How to set Adapter to recyclerview How to create Login Registration Pages with Jetpack Compose? Implement Room database with Jetpack Compose + MVVM How to create Spannable Text in Jetpack compose How to create Toast with Jetpack compose How to Load Web pages with Jetpack compose How to create Navigation drawer with Jetpack compose Jetpack compose Set Custom themes - Light and Dark themes Jetpack compose Pass data between two activities - Parcelable How do we create dropdownmenu with Jetpack compose Jetpack compose Change Button text and color dynamically Jetpack compose Button Click Event Handling Jetpack compose Shimmer Animation Effect Jetpack compose Expandable listview How do i create Jetpack Compose Popup menu How do i create Jetpack Compose Floating action menu How do i create Swipe To Refresh with Jetpack Compose

How to integrate Rest api in android jetpack compose How to pick image from gallery in android Jetpack compose How to Capture Image from Camera with Jetpack compose How do i show number picker with Jetpack compose How do i display progress while loading url - Jetpack compose

Jetpack Compose Todo Application How to show AudioPlayer in Jetpack Compose - Android Media Player to play music Jetpack Compose draw path between two locations, Polylines Jetpack Compose Get Current Location while moving the Google Maps Jetpack Compose How to Add Multiple Markers to Google Maps How do i load GoogleMaps with Jetpack Compose Jetpack Compose Tablayout with Viewpager Jetpack Compose TextField Focus Listener Events How to implement Pagination in Jetpack Compose

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct