I have implemented UmanoSlidingPanel using https://github.com/umano/AndroidSlidingUpPanel . Everything is working fine except that my sliding panel when expanded, the sliding co
1) Have a look at the following Gist I created.
The file sliding_up_activity.xml
could be the activity layout that will include your sliding up panel view.
It is in there where you should set android:fitsSystemWindows="true"
so that any children is inset properly not o fall behind the action bar or nav bar.
The file sliding_view.xml
could be your sliding up view.
You should not need to do anything else in any of the panel callbacks.
You can safely remove the translucent style and the code inside the onPanelSlide()
. This should result with a sliding panel properly inset such that never goes behind the status or nav bars.
Alternatively, if you don't have the same architecture, you could forget about the sliding_up_activity.xml
and set android:fitsSystemWindows="true"
in the CoordinatorLayout
instead, in sliding_view.xml
.
2) The second thing we were talking, is making the status bar translucent, letting the sliding up panel fall behind the status bar and then smoothly add padding to properly inset the contents.
For that, set android:fitsSystemWindows="false"
or remove it from any possible parent your sliding up panel has.
Then in onPanelSlide
you could do something like this
if (slideOffset >= ANCHOR_POINT) {
// adjust the span of the offset
float offset = (slideOffset - ANCHOR_POINT) / (1 - ANCHOR_POINT);
// the padding top will be the base original padding plus a percentage of the status
// bar height
float paddingTop = mSlidePanelBasePadding + offset * mStatusBarInset;
// apply the padding to the header container
mContainer.setPadding(0, (int) paddingTop, 0, 0);
}
where:
mSlidePanelBasePadding
would be the initial padding of you sliding up panelmStatusBarInset
would be the status bar height.That should add padding to your slidingUp panel progressively when it gets past the anchor point.
You can get the status bar height like this:
public int getStatusBarHeight() {
int result = 0;
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
result = getResources().getDimensionPixelSize(resourceId);
}
return result;
}
I hope this helps a bit.