1 / 16

To be an Android Expert

앱창작터. To be an Android Expert. 안드로이드 여대생 기초 과정. ContextMenu , Spinner. 문양세 , 최미정 강원대학교 IT 대학 컴퓨터학부. 메뉴 종류. Options 메뉴 디바이스의 MENU 키를 눌렀을 때 나타난다 . Icon 메뉴 스크린 하단에 나타난다 . 아이콘을 지원하나 , 체크박스나 라디오 버튼은 지원하지 않는다 . Extended 메뉴 Icon 메뉴의 More 를 선택했을 때 보여지는 아이템 목록이다 .

goldy
Télécharger la présentation

To be an Android Expert

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 앱창작터 To be an Android Expert • 안드로이드여대생 기초 과정 ContextMenu, Spinner 문양세, 최미정 강원대학교 IT대학 컴퓨터학부

  2. 메뉴 종류 • Options 메뉴 • 디바이스의 MENU 키를 눌렀을 때 나타난다. • Icon 메뉴 • 스크린 하단에 나타난다. • 아이콘을 지원하나, 체크박스나 라디오 버튼은 지원하지 않는다. • Extended 메뉴 • Icon 메뉴의 More를 선택했을 때보여지는 아이템 목록이다. • Icon 메뉴에 아이템을 모두 표현하지 못했을 때 나타난다. • Context 메뉴 • View(특히 button)를 길게 눌렀을 때, 화면에 떠서 나타나는 메뉴(floating menu)이다. • Submenu • Options 혹은 Context 메뉴 목록에 의해, 화면에 떠서 나타나는 서브 메뉴이다.

  3. Context Menu (1/8) • Context Menu 만들기 (1/4) • PC에서 마우스 오른쪽 버튼과 유사한 기능을 수행한다. • onCreateContextMenu()method에서 add() method를 사용하여 아이템들을 등록한 뒤, • 원하는 view(object)에 해당 컨텍스트 메뉴를 등록(registerForContextMenu())한다.

  4. Context Menu (2/8) Context Menu 만들기 (2/4)TextView, 즉 Console에 Context Menu를 등록한다.

  5. Context Menu (2/8) Context Menu 만들기 (3/4)onCreateContextMenu()를 정의한다.

  6. Context Menu (4/8) Long click Click for submenu Context Menu 만들기 (4/4)

  7. Context Menu (5/8) • 메뉴 아이템 선택하기 (1/4) • 메뉴 아이템이 선택될 때, onContextItemSelected() method가 콜백된다. • getItemId()를 사용하여, 어떤 아이템이 선택되었는지를 식별할 수 있다. • 아이템이 식별되면, 이에 따라 적절한 액션을 취할 수 있게 된다.

  8. Context Menu (6/8) 추가 메뉴 아이템 선택하기 (2/4)

  9. Context Menu (7/8) 메뉴 아이템 선택하기 (3/4)

  10. Context Menu (8/8) 메뉴 아이템 선택하기 (4/4)

  11. AdapterView개요 - revisited • AdapterView는 외부데이터를 바인드(bind)하여, 해당 데이터를 화면에 표시한다. • AdapterView는 (외부) 데이터를 바인드할 View들을 가진다. • Adapter가 (외부) 데이터를 View들에게 바인드한다. • 외부 데이터란? Array 혹은 Content Provider가 제공하는 DB 등 • AdapterView예제: Gallery, ListView, Spinner

  12. Spinner 예제 (1/4) XML Layout을 사용하여, ArrayAdapter생성

  13. AdapterView예제 (2/4) main.xml Spinner에 대한 XML layout을 생성한다.

  14. AdapterView예제 (3/4) MyUiPractice.java Adapter를 사용하여 Spinner를 AdapterView에 bind한다.

  15. AdapterView예제 (4/4) 실행 결과

More Related