티스토리 뷰
이번 포스팅에서는 지난 포스팅에 이어 GridView item click 시 menu 가 나오게 하는 방법 중 popup menu 를 이용하는 방법에 대해 알아보자.
참고로, 지난 포스팅에서는 GridView 에 text + image 목록 출력, click 처리, menu 출력 하는 방법에 대해 알아 보았다.
[Android/UI] - GridView (2) - GridView 에 image + text 출력하기
[Android/UI] - GridView (3) - GridView item 의 click 처리하기
[Android/UI] - GridView (4) - GridView item click 시 context menu 출력하기
Menu XML resource file 추가
GridView item click 시 나오는 menu 를 XML 로 추가하자.
1. 하단 그림과 같이 res 폴더 안에 'menu' 라는 이름으로 폴더를 추가
2. 'main_list_menu.xml' 를 하단과 같이 생성
3. 1번에서 생성한 menu 폴더에 'main_list_menu.xml' 파일을 추가한다.
GridView item long click 시 popup menu 출력
새로 생성한 'main_list_menu.xml' 는 popup menu 생성 시 등록하자.
1. onItemLockClick 시 popup menu 생성 (xml inflate)
2. Popup menu click 시 click event 처리
3. Popup menu 보이기 (꼭 show 를 해야한다.)
Source code
https://github.com/parkho79/GridView_4
'Android > UI' 카테고리의 다른 글
GridView (7) - GridView 에 header, footer 달기 (0) | 2021.02.17 |
---|---|
GridView (6) - GridView item 추가, 수정, 삭제 (0) | 2021.02.17 |
GridView (4) - GridView item click 시 context menu 출력하기 (0) | 2021.02.15 |
GridView (3) - GridView item 의 click 처리하기 (0) | 2021.02.09 |
GridView (2) - GridView 에 image + text 출력하기 (0) | 2021.01.26 |
- Total
- Today
- Yesterday
- onCreateContextMenu
- Android Service
- 리워드 어플
- WEMIX
- mPANDO
- android intent
- android flag activity
- onContextItemSelected
- 리워드앱
- registerForContextMenu
- 앱테크 추천
- 채굴앱
- task 생성
- StartService
- Intent
- task
- android activity flag
- p2e
- bindservice
- notifyDataSetChanged
- 무료 채굴
- M2E
- BroadcastReceiver
- RoomDatabase
- StringUtils
- 안드로이드 인텐트
- 무료채굴
- 앱테크
- android task
- 안드로이드 서비스
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |