일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 프로그래머스
- 자바
- Python
- TypeScript
- frontend
- network
- Algorithm
- db
- 알고리즘
- 리트코드
- 안드로이드
- LeetCode
- vscode
- java
- Javascript
- git
- VIM
- 그레이들
- 백준
- BFS
- Data Structure
- DFS
- Database
- 다이나믹 프로그래밍
- DP
- Graph
- 동적 계획법
- CS
- react
- Redux
Archives
- Today
- Total
늘 겸손하게
안드로이드 Drawable resource를 변수(객체)와 연결하기 본문
안녕하세요 besforyou 입니다
이번 글에서는 Drawable 변수를 생성하고, Drawable resource를 변수에 연결하는 법에 대하여 소개하겠습니다
1
|
Drawable drawable = ContextCompat.getDrawable(context, R.drawable.리소스이름);
|
cs |
위 코드로 drawable 객체와 drawable resource를 연결할 수 있습니다.
이제 drawable 객체를 함수의 인자로 주는 것도 가능합니다.
'Programming > Android' 카테고리의 다른 글
안드로이드 BluetoothAdapter로 블루투스 검색이 안될때 ( 매니페스트 추가 ) (0) | 2021.08.27 |
---|---|
안드로이드 Logcat 사용법 (0) | 2021.08.23 |
안드로이드 블루투스 신호 강도(RSSI) 찾기 (0) | 2021.08.19 |
안드로이드 스튜디오 그레이들 버전 바꾸기 (0) | 2021.08.18 |
안드로이드 cannot resolve symbol cannot resolve symbol '@integer/google_play_services_version' (0) | 2021.08.18 |