일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Kotlin
- Gradle
- 프로그래머스
- Rxjava
- ProGuard
- android
- 코루틴
- Coroutine
- 백준
- AWS
- Codeforces
- androidStudio
- Hilt
- 암호학
- Python
- livedata
- GitHub
- architecture
- Compose
- MyVoca
- MiTweet
- TEST
- pandas
- textfield
- relay
- boj
- Coroutines
- 쿠링
- 코드포스
- activity
- Today
- Total
목록Primary/Compose (33)
이동식 저장소
``tint = Color.Unspecifed``를 설정하자. 하... Icon( painter = painterResource(...), contentDescription = null, tint = Color.Unspecified, )

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..