Android Question Android 7.0 NavigationBar hides bottom of Activity

JohnC

Expert
Licensed User
Longtime User
One of my testers has a Galaxy S8 running Android 7.0

For phones that do not have dedicated hardware back/home/task buttons at the bottom of the phone, there is (what I believe it's called) a Navigation Bar, which displays the Back, Home and Task buttons on the bottom of the screen.

If the user chooses to hide the nav bar, when a B4A activity is shown, it displays all the way to the physical bottom of the display. And if the user then flicks up from the bottom, the nav bar appears transparently over the bottom of the activity.

But, the S8 (and maybe other Android 7.0 devices), allows the user to then Lock (or dock) the Nav bar at the bottom of the display. If they do this, then the nav bar is no longer transparent and visually blocks whatever was showing at the bottom of the activity. The activity is not automatically resizing to the new reduced screen space.

I did some testing, and yes the IME_HeightChanged event is triggered (if I add the IME lib and associated code to the activity). But I usually only needed to add IME for activities that had textboxes on them so they could deal with the screen resizing due to the keyboard being shown/hidden.

Does this mean I now have to add IME support to *EVERY* activity of every app from now on?

If so, is there some way B4A could automatically handle any HeightChanged events and automatically resize the contained views according to their specified anchor's (just like what it does when an activity is first shown)?
 

BillMeyer

Well-Known Member
Licensed User
Longtime User

Yes Sir, this is the feature in question. I used what is possibly a work around - but it functions perfectly for me.

Background.
I used a Samsung Galaxy S6+ for my initial development on my app and set the derivative screen size to 411 x 731 x 1.
I then got the Samsung S8+ with the screen feature mentioned above, whose size in real format is 1440 x 2792 x 3.5 - if you enter this as a derivative it normalizes to 411 x 797 x 1. (Note only the difference on the height)
OK. So testing this app on the S8+, I did get the black stripe at the bottom of the screen after double tapping the little pin dot on the bottom left of the screen whilst in the app.

Work Around.
There are two ways in which you can go about it (as I did - adapted to the requirements of the display I was building).

1. Add a new derivative of 411 x 797 x 1 and adjust your design to suit, to fill the screen appropriately, or

2. I used anchors where I could to secure both the horizontal and the vertical sides in the Designer. This solution eliminates the requirement for adding the new derivative and will automatically adjust your display size depending on what the app user has set their desire to use on their Nav Bar.

The only thing I have as yet not figured out, is how to adjust the app screen immediately when the user taps this pin button. Currently I have to go one page back and then re-load the page in question - it then adjusts to fill the screen, and implies that you need to re-start the app if this happens on the Main Screen. I am currently checking the IME solution and will report back if I get it to work.

This will probably also be a requirement in b4i soon as I see the new iPhone X has the same feature.

One last word of advice - watch your designs for these new screens - If you use a "square" icon (especially on full screen apps) in one of the corners, it will most likely be rounded and cut off as this is what these screens do - they round their corners.

I trust that this will help in the meanwhile.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Yes, that's it.

1) If the user has the navbar always visible, the anchors work as intended when a B4A form is first displayed.
2) If the user has the navbar always hidden, the anchors work as intended when a B4A form is first displayed. And if the user swipes up from the bottom, the semi-transparent navbar will then appear over the bottom of the activity, but the user can easily swipe down to see it whats underneath it again.

The problem is when the navbar is hidden while an B4A activity it showing, and then the user double-taps the narbar to make it "always visible". The navbar will then cover the bottom of the activity. If a google app was visible when this happens, it will automatically shorten the activity to compensate for the reduced screen height.

Also, if the navbar is set to "always visible" when a B4A activity is first shown, then the user double-taps it to change it to "hidden", then there will be a blank space under the B4A activity (where the navbar was).
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The main problem here is that normally Android recreates the activities when the activity size changes. The flow here is different.

I do plan to add resizable layouts to B4A (as already implemented in B4J and B4i). However I'm not sure that all the required information and events are available in Android. I need to further investigate it.
 
Upvote 0

BillMeyer

Well-Known Member
Licensed User
Longtime User
The main problem here is that normally Android recreates the activities when the activity size changes. The flow here is different.

I do plan to add resizable layouts to B4A (as already implemented in B4J and B4i). However I'm not sure that all the required information and events are available in Android. I need to further investigate it.

Thank you Sir - in the meantime my workaround works for.
 
Upvote 0
Top