[Android Studio] 16진법 컬러표(HexaCode), Button, Text 활용

Jean·2023년 8월 2일
0
post-thumbnail

헥사코드 컬러표 링크
https://namu.wiki/jump/MeblbW7DTRcwhfMKIdcuMZPoHroDDt242N0zMSCSi%2B1WNONj1Y1lZOCXwv7FV%2B27

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            CountupTheme {
                // A surface container using the 'background' color from the theme
                Surface(
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colorScheme.background
                ) {
                    var count by remember { mutableStateOf(0) }
                    Box() {
                        Button(
                            onClick = { count++ },
                            modifier = Modifier
                                .align(Alignment.Center)
                                .size(200.dp, 200.dp),
                            colors = ButtonDefaults.buttonColors(
                                containerColor = Color(0xff75bbcf),
                                contentColor = Color.White
                            )
                        )
                        {
                            Text(
                                text = "${count}",
                                color = Color.White,
                                fontWeight = FontWeight.Bold,
                                fontSize = 50.sp
                            )
                        }
                    }

                }
            }
        }
    }
}
  • 버튼 클릭 수 누적해서 보여주는 법
  • 버튼 컬러 변경
  • 텍스트 컬러 변경
  • 폰트 사이즈 및 볼드 처리
profile
아 왜 안돼

0개의 댓글