Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 31 |
Tags
- 광고 id
- Jenkins
- 오퍼월
- chrome
- nginx
- kotlin
- docker
- React
- 코딩테스트
- it
- css
- toml
- spring boots
- Next
- 개발
- 파이썬
- 백준
- 오블완
- Express
- AWS
- TypeScript
- 코테
- react-native
- JavaScript
- EC2
- python
- Android
- NanoHttpd
- 티스토리챌린지
- nuxt
Archives
- Today
- Total
내맘대로 개발일지
[Kotlin] This view is not constrained vertically: at runtime it will jump to the top unless you add a vertical constraint 본문
Android/Kotlin
[Kotlin] This view is not constrained vertically: at runtime it will jump to the top unless you add a vertical constraint
eulBlue 2023. 8. 9. 22:58
📱테스트 환경
Samsung Galaxy Android 13 • Android 10
😢 내가 겪은 문제
xml 에서 ImageView 를 만들었는데, 에러가 발생했다. 나는 이미지를 Kotlin 에서 동적으로 넣어주고 싶어서 src 를 지정을 안했는데, 이게 문제인가 싶었는데 다른게 문제였다.
에러를 풀이하면 레이아웃에서 사용되는 ImageView에 수직으로 제약이 설정되지 않았다는 것이다.
결과적으로 실행 시에 예상치 못한 동작을 할 수 있어서 뷰가 컨테이너의 맨 위로 이동할 수 있다는 경고였다.
이를 해결하기 위해서는 간단하게 필요한 코드를 추가해주면 끝난다.
app:layout_constraintStart_toStartOf="parent"
or
app:layout_constraintEnd_toEndOf="parent"
or
app:layout_constraintTop_toTopOf="parent"
or
app:layout_constraintBottom_toBottomOf="parent"
부모 컨테이너를 기준으로 위치를 조정해주면 아주 간단하게 문제를 해결할 수 있다 : )
'Android > Kotlin' 카테고리의 다른 글
| [Kotlin] MAC .apk • .aab Build (0) | 2023.08.10 |
|---|---|
| [Kotlin] ByteArray -> Bitmap Image Resize (0) | 2023.08.09 |
| [Kotlin] Activity 간에 데이터 주고받는 방법 (0) | 2023.08.09 |
| [Kotlin] 앱 알림 보내기 (0) | 2023.08.09 |
| [Kotlin] Activity 이동 시 Animation 제거하는 방법 (0) | 2023.08.09 |