Context:
In the android-7.1.1_r12
api, the android.hardware.camera2
uses a StickyBottomCaptureLayout
as a "BottomBar"
to display the action buttons (as switch-camera, shutter and recent picture buttons). Whatever the device orientation, this StickyBottomCaptureLayout
is displayed always above/near the system bar (which has back, home and other apps buttons).
For example, this is what it looks when the rotation degree is 0
or 180
:
And, by orienting the device and get a rotation degree as 90
or 270
, the StickyBottomCaptureLayout
is now near the system bar:
Usually, this above screenshot should has the sticky bar on the left and camera on the right...
Tries:
I firstly tried to set different layout with
layout-land
, but no luck! I cannot change the default left-to-right orientation and get the bottom bar sticks to the Android system bar on270
degrees.I cannot extend these widgets, but I tried to reproduce the case. For example, I got two layouts:
<FrameLayout> <ViewGroup .../> // containing the upper views <StickyBottomBar .../> // same behavior as StickyBottomCaptureLayout </FrameLayout>
On each orientation changes, I get the rotation's device and set the correct gravity for upper layout and the sticky bar, something as follows:
if (rotation == 0) { // views gravity = TOP // sticky gravity = BOTTOM } else if (rotation == 90) { // views gravity = LEFT // sticky gravity = RIGHT } else if (rotation == 180) { // views gravity = BOTTOM // sticky gravity = TOP } else if (rotation == 270) { // views gravity = RIGHT // sticky gravity = LEFT }
However, this is not working at all. I don't know how these widgets make it work properly.
Question:
Does someone has a solution to reproduce the case of the bottom bar when the device orientation is changing (always above or near the Android system bar)? Keeping in mind that my minimum SDK is below 21
, so I have no access to android.hardware.camera2
api.