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
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…