Upload Tugas Helloword

This commit is contained in:
202310715130 DWI FEBRYANTI 2025-11-05 19:47:10 +07:00
commit 1ea080fcba
2 changed files with 49 additions and 0 deletions

49
Helloword/MainActivity.kt Normal file
View File

@ -0,0 +1,49 @@
package com.example.helloword
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.example.helloword.ui.theme.HellowordTheme
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
HellowordTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
HelloWorldScreen()
}
}
}
}
}
@Composable
fun HelloWorldScreen() {
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {
Text(text = "Hello World!")
}
}
@Preview(showBackground = true)
@Composable
fun PreviewHelloWorld() {
HellowordTheme {
HelloWorldScreen()
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB