[TIMOB-23974] Android: Add property to release space when hiding an object
GitHub Issue | n/a |
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-10-06T15:28:08.000+0000 |
Affected Version/s | Release 5.5.0 |
Fix Version/s | Release 6.1.0 |
Components | Android |
Labels | android, community, notable, property, visible |
Reporter | Michael Gangolf |
Assignee | Hans Knöchel |
Created | 2016-10-02T09:57:50.000+0000 |
Updated | 2017-12-18T18:52:26.000+0000 |
Description
On Android you can set 3 visible values: visible, invisible and gone. Currently gone is not supported in Titanum. With this setting you can free the space an object has when hiding it.
The screenshot shows two vertical layout views with the first three elements hidden. On the left side is the normal behaviour; on the right side I've used gone instead of invisible (the four bottom boxes move up).
The property is called hiddenBehavior
and can control the behavior when hiding a view. When you set it to true
and call hide()
it will either release the space (new) or retain the space (default). Default value is still Ti.UI.VIEW_INVISIBLE
so it behaves like normal when you don't change it.
When you show the object again it will take up the previous space again
*Current workaround to release the space:*
Hiding: save the current object height, hide the object, set the height to 0.
Showing: show the object, set the height to the saved value.
*Parity?*
Not sure if this is possible on iOS. Perhaps someone else can add this part
Attachments
PR: https://github.com/appcelerator/titanium_mobile/pull/8458 in the documentation I've put 6.0.0. Not sure if its 6.1.0 already :)
Changed the property name to
hiddenBehavior
with two constantsTi.UI.HIDDEN_BEHAVIOR_INVISIBLE
andTi.UI.HIDDEN_BEHAVIOR_INVISIBLE
Updated example:Verified fixed,
hiddenBehavior: Ti.UI.HIDDEN_BEHAVIOR_INVISIBLE
was able to hide the objects in the list of boxes without any of the boxes moving up. WhileTi.UI.HIDDEN_BEHAVIOR_GONE
was able to hide the objects and then the remaining boxes would move up. *Environment *Hi guys, is there parity for this functionality in iOS? Thanks
If I remember correctly there was no equivalent on iOS to release hidden space, so you have to use the
height:0
workaround