Android Question [Solved] Set view to topmost of an activity?

Status
Not open for further replies.

ducphu

Active Member
Licensed User
Longtime User
Hi all,

If you know about Candy Crush or Farm Heroes game, when you are out of move (lose a game), a popup will appear asking whether you want to buy more moves or power up...

I want to design something similar. My main activity (Activity1) also has an variable called "moves" and it will be reduced as the player plays. If moves = 0, I want to have a popup appear. My question is:

1. If I design the popup as an label in the same activity, how can I set it to topmost of Activity1, and dim and disable all other views in the activity?
2. Can I design the popup in a new activity (Activity2), if can, then how to make Activity2 transparent so that I till can see Activity1 as background, i,e Activity2 on top of Activity1
 

HotShoe

Well-Known Member
Licensed User
Longtime User
You can put it on a semi-transparent panel. set the color of the panel to black and the alpha to 50% or so. set the panel top and left to 0 and the width to 100%x, set its height to 100%y. Make sure to set the label of the parent to the panel if you do it in the designer. Than when you want to display it, do: movespan.bringtofront (or whatever you name the panel). When finished, use: movespan.sendtoback.

--- Jem
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

ducphu

Active Member
Licensed User
Longtime User
Hi HotShoe, thank u, it's exactly what I'm looking for :)
Hi DonManfred, I will have a look at that lib. Thank u.
 
Upvote 0
Status
Not open for further replies.
Top