MainActivity.kt

// Button Toast

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            DefaultTheme {
                MyBtn()

            }
        }
    }
}

@Composable
fun MyBtn() {

    val context = LocalContext.current

    Button(onClick = {
        Log.d("Main", "onClick")
        Toast.makeText(context, "클릭완료", Toast.LENGTH_LONG).show()
    },
    colors = ButtonDefaults.buttonColors(
        containerColor = Color.Yellow,
        contentColor = Color.Blue
    ),
    modifier = Modifier
        .width(200.dp)
        .height(300.dp)
    ) {
        Text(
            text = "버튼버튼 버튼입니다 버튼버튼버튼버튼",
            lineHeight = 50.sp,
            fontSize = 30.sp,
            color = Color.Red
        )
    }
}

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
    DefaultTheme {
        MyBtn()
    }
}