XML과 Compose 비교











>> YOUR LINK HERE: ___ http://youtube.com/watch?v=UUvN12wUHpA

[Developing Android Apps] 7. XML vs Compose Comparison • • #XML #Compose #코틀린 #Android #Koala #AndroidApp #App #AppDevelopment #AndroidStudio #kotlin • [Codes] ● = left angle bracket(less than), ■ = right angle bracket(greater than) • ========================================================================== • ** 1.1 XML Code : MainActivity.kt ** • package com.join.xmlex1 • import android.os.Bundle • import androidx.activity.enableEdgeToEdge • import androidx.appcompat.app.AppCompatActivity • import androidx.core.view.ViewCompat • import androidx.core.view.WindowInsetsCompat • class MainActivity : AppCompatActivity() { • override fun onCreate(savedInstanceState: Bundle?) { • super.onCreate(savedInstanceState) • enableEdgeToEdge() • setContentView(R.layout.activity_main) • ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets -■ • val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()) • v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) • insets • } • } • } • • ** 1.2 XML Code : activity_main.xml ** • ●?xml version= 1.0 encoding= utf-8 ?■ • ●androidx.constraintlayout.widget.ConstraintLayout xmlns:android= http://schemas.android.com/apk/res/an... • xmlns:app= http://schemas.android.com/apk/res-auto • xmlns:tools= http://schemas.android.com/tools • android:id= @+id/main • android:layout_width= match_parent • android:layout_height= match_parent • tools:context= .MainActivity ■ • ●TextView • android:layout_width= wrap_content • android:layout_height= wrap_content • android:text= Hello World! • app:layout_constraintBottom_toBottomOf= parent • app:layout_constraintEnd_toEndOf= parent • app:layout_constraintStart_toStartOf= parent • app:layout_constraintTop_toTopOf= parent /■ • ●/androidx.constraintlayout.widget.ConstraintLayout■ • ========================================================================== • ** 2. Compose Code : MainActivity.kt ** • package com.join.comex1 • import android.os.Bundle • import androidx.activity.ComponentActivity • import androidx.activity.compose.setContent • import androidx.activity.enableEdgeToEdge • import androidx.compose.foundation.layout.fillMaxSize • import androidx.compose.foundation.layout.padding • import androidx.compose.material3.Scaffold • import androidx.compose.material3.Text • import androidx.compose.runtime.Composable • import androidx.compose.ui.Modifier • import androidx.compose.ui.tooling.preview.Preview • import com.join.comex1.ui.theme.Comex1Theme • class MainActivity : ComponentActivity() { • override fun onCreate(savedInstanceState: Bundle?) { • super.onCreate(savedInstanceState) • enableEdgeToEdge() • setContent { • Comex1Theme { • Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -■ • Greeting( • name = Android , • modifier = Modifier.padding(innerPadding) • ) • } • } • } • } • } • @Composable • fun Greeting(name: String, modifier: Modifier = Modifier) { • Text( • text = Hello $name! , • modifier = modifier • ) • } • @Preview(showBackground = true) • @Composable • fun GreetingPreview() { • Comex1Theme { • Greeting( Android ) • } • }

#############################









Content Report
Youtor.org / YTube video Downloader © 2025

created by www.youtor.org