내용으로 건너뛰기
법학위키
사용자 도구
등록
로그인
사이트 도구
검색
도구
문서 보기
이전 판
역링크
최근 바뀜
미디어 관리자
사이트맵
등록
로그인
>
최근 바뀜
미디어 관리자
사이트맵
추적:
android:토스트메시지
토스트메시지
이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요.
===== 의의 ===== 안드로이드에서 토스트 메시지를 만드는 함수 예제이다. {{:android:안도로이드토스트.png?400|토스트 메시지}} 개발시에 log 대신에 사용해도 괜찮다. ===== 토스트 메시지 만들기 ====== <code kotlin> val notification = rememberSaveable { mutableStateOf("") } if (notification.value.isNotEmpty()) { Toast.makeText(LocalContext.current, notification.value, Toast.LENGTH_LONG).show() notification.value = "" } </code> ===== 토스트 메시지 부르기 ===== <code kotlin> Text(text = "Cancel", modifier = Modifier.clickable { notification.value = "Cancelled" }) </code> ===== 전체 예제 ===== <file kotlin settingScreen.kt> @Composable fun SettingsPage(modifier : Modifier = Modifier) { val notification = rememberSaveable { mutableStateOf("") } if (notification.value.isNotEmpty()) { Toast.makeText(LocalContext.current, notification.value, Toast.LENGTH_LONG).show() notification.value = "" } Column (modifier = modifier .background(GreenColorJC) .padding(8.dp) .verticalScroll(rememberScrollState()) .safeDrawingPadding(), ) { Row(modifier = modifier .fillMaxWidth() .padding(8.dp) ) { Text(text = "Cancel", modifier = Modifier.clickable { notification.value = "Cancelled" }) Text(text = "Save", modifier = Modifier.clickable { notification.value = "Saved" }) } } } </file>
android/토스트메시지.txt
· 마지막으로 수정됨:
2024/07/28 01:47
저자
이거니맨
문서 도구
문서 보기
이전 판
역링크
맨 위로