Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Placing/Overlapping (z-index) a view above actionbar tabs

I have a View that draws something outside the Fragment containing it and I configured it to draw the content outside it using this.

The problem is that it works everywhere but on the ActionBar and ActionBar Tabs.

mActionBar.addTab(
    mActionBar.newTab()
        .setCustomView(t));

I am using appCompat and adding tabs this way:

I added android:clipChildren="false" to all the parent Views, but it doesn't work just for ActionBar and ActionBar tabs.

The desired view:

enter image description here But the result is this:

enter image description here

like image 494
Morteza Rastgoo Avatar asked Sep 23 '15 08:09

Morteza Rastgoo


1 Answers

It's not easy to help you without the complete source code; anyway I can suggest you an alternative approach which may suit your case.

If you are creating a custom floating item (maybe used for a tutorial or an hint), you should avoid to alter the base views hierarchy and prefer a pure overlay solution.

The PopupWindow is exactly what you need:

A popup window that can be used to display an arbitrary view.

Since the PopupWindow acts at Activity level, it should overlay everything in your current Activity.

The popup window is a floating container that appears on top of the current activity.

You can find a simple example here.

like image 154
bonnyz Avatar answered Oct 22 '22 18:10

bonnyz