일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- Compose
- Coroutines
- Codeforces
- ProGuard
- android
- AWS
- 백준
- Gradle
- 쿠링
- Rxjava
- Hilt
- architecture
- Coroutine
- Python
- 코루틴
- androidStudio
- MyVoca
- MiTweet
- 암호학
- activity
- GitHub
- boj
- Kotlin
- 코드포스
- textfield
- relay
- livedata
- TEST
- pandas
- 프로그래머스
- Today
- Total
목록Compose (31)
이동식 저장소

Compose로 혼자 뚝딱뚝딱 하던 도중 composable이 어떠한 방식으로든 터치되고 있는지 확인해야 하는 경우가 생겼다. 어떤 방식으로든 focus를 받고 있을 때 아이콘을 보여주고 싶었기 때문이다. 이 기능을 구현하려면 일단 Compose에서의 터치 이벤트를 공부해야 한다. 일단 터치 이벤트가 발생했는지 판단하는 isFocused 변수를 선언하자. 이 값이 true이면 터치 이벤트가 발생한 것이므로 아이콘을 보여줘야 한다. @Composable fun RotatingIndicatorGradient() { var isFocused by rememberSaveable { mutableStateOf(false) } RotatingGradient { AnimatedVisibility( visibl..
CompositionLocal 값 중 LocalInspectionMode를 참조하면 된다. True if the composition is composed inside a Inspectable component. 사용 예시는 다음과 같다. val isPreview = LocalInspectionMode.current Box { if (isPreview) { // 이 구문은 Preview에서만 실행됨 } // 이 구문은 항상 실행됨 } 참고자료 androidx.compose.ui.platform | Android Developers androidx.car.app.managers developer.android.com

Compose에서 Brush는 화면에 그려지는 원, 사각형, path 등이 어떻게 그려질지를 나타낸다. 단색을 표현하는 SolidColor도 있지만, 주로 그라디언트를 표현하기 위해 사용한다. Brush는 Modifier.background(), TextStyle, DrawScope에서 사용할 수 있다. 텍스트에도 brush를 적용할 수 있다는 점 기억하기! 그라디언트 Brush에 정의되어 있는 그라디언트는 다음과 같다. 모두 Brush.[some]Gradient(color) 형태로 사용할 수 있다. 이름만 보면 쉽게 이해할 수 있다. Horizontal과 vertical은 수평 및 수직 그라디언트를 나타내고, linear는 일반적인 직선 그라디언트를 나타내며,..

LazyColumn에서 리스트 앞에 아이템을 추가하면 스크롤 위치가 위로 올라가 버린다. 스크롤 위치를 기억하고 싶다면 아이템의 key를 설정해야 한다. 공식 문서에는 다음과 같이 적혀 있다. When you specify the key the scroll position will be maintained based on the key, which means if you add/remove items before the current visible item the item with the given key will be kept as the first visible one. 당연히 key는 유일해야 한다. 가장 쉬운 구현 방법은 아마도 hashCode()일 것이다. val items..

Compose에서 slot이란 사용자가 원하는 뷰로 채울 수 있게 비워둔 공간을 의미한다. 주로 컨테이너 역할을 하는 composable을 구현할 때 사용하는 패턴이다. 예를 들어 TopAppBar에는 다음 그림처럼 빈 공간이 3개 있는데, 왼쪽부터 각각 navigateIcon, title, actions를 위한 공간으로 할당되어 있다. @Composable fun TopAppBar( title: @Composable () -> Unit, modifier: Modifier = Modifier, navigationIcon: (@Composable () -> Unit)? = null, actions: @Composable RowScope.() -> Unit = {}, backgr..