Android LinearLayout on top of ActionBar?


this seems like a very simple issue but I can't seem to figure it out.

I am adding a LinearLayout to my active Activity when a button is pressed but I want this layout to be on top of the whole activity, that includes the ActionBar. I want the layout to work like a Dialog but I think Dialog is too heavy for what I am trying to do so I want to use a layout.

I tried applying Flags and Type when I am setting the layout's WindowManagerLayoutParams but nothing helps.

this is what I tried:

WindowManagerLayoutParams mainLayoutParams = new WindowManagerLayoutParams ();  
mainLayoutParams.Height = 600;  
mainLayoutParams.Width = 300;  
mainLayoutParams.Gravity = GravityFlags.Center; 
mainLayoutParams.Flags = WindowManagerFlags._______
mainLayoutParams.Type = WindowManagerTypes._______

I wrote "______" because I've tried ALL different ones but it makes no difference.

Please give me solution in which I can do this programmatically (not XML) since my layout is created manually.

How can I do this?

Thank you for your time.

This video can help you solving your question :)
By: admin