Find location of activity in multiwindow mode android

563 views Asked by At

I want to know whether my activity is in upper view or bottom view in the multi-window mode.

The reason for this is I'm using a custom MediaController in a player activity which gets behind the NavigationBar.

Earlier I handled this by adding a bottom margin of the NavigationBarheight to the MediaController but I can't use it in multi-window mode.

When the activity is in upper view of the multi-window mode, I need to remove the bottom margin and when it is in bottom view, I have to provide the bottom margin.

I've tried applying android:fitsInSystemWindows=true attribute to the activity layout and media controller layout, but it didn't help.

Can anyone help me with this?

1

There are 1 answers

4
Orest Savchak On

You can use View:getWindowVisibleFrame method and check rect.top.