Android Question 100%y inconsistence persist

Slacker

Active Member
Licensed User
Longtime User
Hello Folks, this problem seems to be persist still:
http://www.b4x.com/android/forum/threads/the-height-of-100-y-is-including-the-system-bar-height.30413/



I have B4A 3.20 release; not in all devices but in some old tablets or smart phones it continues to exist: Erel did you fix this issue still ? The issue is frequent when you position a view at bottom of the activity using this code: View.Top = 100%y - View.Height.

Testing with emulator, this happen too (especially landscape mode).

Thank you!
 

Slacker

Active Member
Licensed User
Longtime User
Uhm... Erel, all my activities are all set to FullScreen = False except ONE activity. But it happens in a NON-fullscreen activities even i don't visualize in the application the activity where i have set FullScreen = True.

Do you have any further suggestion ?
 
Upvote 0

Slacker

Active Member
Licensed User
Longtime User
It happens in a Tablet i have and in the Emulator, with the same settings.... let me check some parts of the code and i will update you soon if i do not find a solution.
 
Upvote 0

Slacker

Active Member
Licensed User
Longtime User
Found the problem. It was pretty complex but i will try to explain (the cause is my not fully matured knowledge in B4A stuff).
I have a main activity with a layout, CREATED BY DESIGNER, where there's a fixed top panel of 50dip (Height = 50 set in designer). At bottom of this Top panel i have the MAIN panel which take the all remaining 100% of the vertical space where i load inside other layouts making them to slide showing several contents, based on user preferences. Where i load these layouts i using as top the reference as 50dip BY CODE.... and this was the problem!

With difference screen resolution/scale, (i had tested just with 320 x 480 the changes i did through CODE and not Designer) Android scaled the JUST views it takes from layout created by designer.... so the 50dip i had set in designer, in CODE lost its reference regards those views i add dinamically using the constant 50dip. There wasn't a full reference, by the 50dip height i declared in view in designer and the 50dip i used dinamically in code as reference to set coordinates for other views. I moved to remove the reference of 50dip in code and i used TopPanel.Height reference or other measure that is calculated at Runtime. And everything worked fine.

Conclusion: what is scaled by Android that is CREATED by Designer, it cannot be used as measure reference for views we add later in code except we take their measures from Runtime-calculated values; using the same constant we declared in Designer, in code, get wrong and unexpected results.

Now i know. Thank you the same Erel, and forgive time lost.
 
Upvote 0

Slacker

Active Member
Licensed User
Longtime User
Actually, the problem seems come back when i switch from a fullscreen activity to a non-fullscreen activity.

Yes.... Erel, Is there a way to bypass or to workaround the issue ? What do you suggest me to do ?

Thank you
 
Upvote 0

Slacker

Active Member
Licensed User
Longtime User
Yes, it's right, i think that's the more straightforward solution.

Thank you Erel.
 
Upvote 0
Top