Let's assume you ordinarily would call setContentView(R.layout.main)
, but on first run, you want to have this overlay.
Step #1: Create a FrameLayout
in Java code and pass that to setContentView()
.
Step #2: Use LayoutInflater
to inflate R.layout.main
into the FrameLayout
.
Step #3: Use LayoutInflater
to inflate the overlay into the FrameLayout
.
Step #4: When the user taps the button (or whatever) to dismiss the overlay, call removeView()
to remove the overlay from the FrameLayout
.
Since the overlay is a later child of the FrameLayout
, it will float over top of the contents of R.layout.main
.
"Coach mark" is "Help overlay" in UX talk :-) coach_mark.xml is your coach mark layout coach_mark_master_view is the id of the top most view (root) in coach_mark.xml
Adding sample of coach_mark.xml (to this excellent solution given by Oded Breiner), so its easy for ppl to copy & paste to see working example quickly. Sample of coach_mark.xml here, change the -> drawable/coach_marks to your image: coach_mark.xml
And optionally use this theme to remove padding:
|
'옛날' 카테고리의 다른 글
멀티 해상도 [Android] (0) | 2015.12.11 |
---|---|
튜토리얼 페이지 [Android] (0) | 2015.12.11 |
Webview 소스 [Android] (0) | 2015.12.11 |
안드로이드에서 웹서버에 post로 글쓰기 [Android] (0) | 2015.12.11 |
네트워크 상태 [Android] (0) | 2015.12.11 |