본문 바로가기

Android(Kotlin)

(26)
[Kotlin][Android] 리스트뷰 커스텀 어뎁터 사용하는 법(ListView Custom Adapter ) 0. 모델 객체와 커스텀 어뎁터 이들 두 가지를 만들 것이다. 1. 먼저 모델 객체를 만들어야 한다. 모델 객체 : 한 리스트에 출력해줄 데이터들을 어떤 것들을 선언을 할거냐 먼저 Activity 폴더에서 우클릭 -> New -> Kotlin ClassFile 을 클릭해준다. 모델 객체를 사용하는 이유는 이전에는 단순히 문자열이 담긴 리스트를 가져다가 문자열을 하나씩 출력해 준 것에 나해 이제는 사진도 넣고 다양한 view들을 원하는 대로 담아주기 위해서 그렇다. package com.example.myapplication // 클래스 모델 객체. class User (val time : String, val task : String, val lock : String, val alarm : Int) 리스..
[Kotlin][Android] ListView 사용하는 방법 배열 선언 arrarOf() ListView id 가 listView인 상태 view선택.adapter = ArrayAdapter(this, 모양, 대상 리스트) val item = arrayOf("08:10","08:10","08:10","08:10","08:10") binding.listView.adapter = ArrayAdapter(this, android.R.layout.simple_expandable_list_item_1, item)
[Android] 토스트 메시지 안뜰때 (부제 : The selected AVD is currently running in the Emulator. Please exit the emulator instance and try wiping again.) 증상 코드에는 오류가 없었느나 토스트 메시지가 에뮬레이터 상에서 표시가 안되었다. 에러 메시지 없음 The selected AVD is currently running in the Emulator. Please exit the emulator instance and try wiping again. 해결 이렇게 하면 된다고 하는데 The selected AVD is currently running in the Emulator. Please exit the emulator instance and try wiping again. 안된다. 다른 글을 참고하여 *.lock 파일을 삭제해주자. 뭐 실행중이다 이런 말이 떠서 안드로이드 스튜디오를 종료시켜주고 다시 실행 하여 Wipe Data 를 실행하였더니 되었다...
[Android] This view is not constrained. It only has designtime positions, so it will jump to (0,0) at runtime unless you add the constraints 증상 에뮬레이터를 실행하면 레이아웃의 디자인탭과는 다르게 자꾸 좌측 최상단으로 뷰가 이동함. 에러메세지 This view is not constrained. It only has designtime positions, so it will jump to (0,0) at runtime unless you add the constraints 해결 우측 의 Constraint Widget으로 자리를 지정해주면 됨. 파란색 플러스 버튼 클릭하면 해결
[Android] 안드로이드 에뮬레이터 뒤로가기 안보임 증상 에뮬레이터 하단의 뒤로가기 버튼이 안보여 클릭시 이동하는 기능 테스트의 재가동 고역 보라색으로 버튼이 출력되는 것을 해결하기 위해 themes.xml을 건드린게 원인인지 뭔지 잘 모르겠다. 에러메세지 없음 해결 뒤로가기 버튼 ESC. 단축키로 일단 사용
[Android] 이미지 버튼이 보라색에서 안 바뀔 때 해결 방법 증상 이미지를 버튼의 android:background 속성값에 부여해 주려 하였으나 원래 색상과 다르게 온통 보라색으로만 표시되었다. 해결 app/src/main/res/values/themes.xml 의 하이라이트 한 부분을 형광펜 친 부분을 Theme.AppCompat.Light 로 바꾸자 Theme.AppCompat.Light 해결! 참고블로그 https://geonho96.tistory.com/m/42 [안드로이드] 버튼이 보라색에서 안 바뀔 때 해결 방법 버튼이 보라색에서 안 바뀔 때 해결 방법 프로젝트의 res/values/themes/themes.xml 파일을 열자 형광펜 친 부분을 Theme.AppCompat.Light 로 바꾸자 해결 geonho96.tistory.com
[Kotlin][Android] Error : Call requires API level 26 (current min is 21): `java.time.LocalDateTime#now` 현상 안드로이드의 현재 시간을 가져오는 java.time을 쓰려고 코드를 가져와서 import도 하였는데 다음과 같은 오류메세지가 떴다. 에러 메세지 Error : Call requires API level 26 (current min is 21): `java.time.LocalDateTime#now` 해결 build.gradle 에 minSdk 를 21->26으로 변경해주고 Sync Now 를 해주었다. 오류가 해결된 모양이다. https://designedbyy.tistory.com/entry/%EC%95%B1%EC%9D%98-%ED%83%80%EA%B2%9F%ED%8C%85-API-%EC%88%98%EC%A4%80%EC%9D%84-30-%EC%9D%B4%EC%83%81%EC%9C%BC%EB%A1%9..
[Android] ImageView에 원하는 이미지 가져와서 넣기 폴더에서 이미지를 app/src/main/res/drawable 에 넣어준다.