B4A Library [Class] ExpandViews

A class / library to easily manage the expansion / collapsing of N B4XViews.

1.gif


The initial code was here:
https://www.b4x.com/android/forum/threads/b4x-xui-expandview-source-code.93134/

Due to some problems with the SetLayoutAnimated command, it was not possible to get good animation for Collapse; it is then necessary to use the @Informatix's library NineOldAndroids, so the class posted here only works with b4a-Android. Despite this, I still used the B4XViews.
 

Attachments

  • ExpandViews demo.zip
    42 KB · Views: 138
  • ExpandViews lib.zip
    4.8 KB · Views: 127
  • ExpandViews class.zip
    1.3 KB · Views: 138
Last edited:

Erel

B4X founder
Staff member
Licensed User
Cross platform collapse view:
B4X:
Sub CollapseView (View As B4XView, Duration As Int) As ResumableSub
   Dim InitialWidth As Int = View.Width
   Dim n As Long = DateTime.Now
   Do While DateTime.Now < n + Duration
       Dim progress As Float = (DateTime.Now - n) / Duration
       View.SetLayoutAnimated(0, View.Left, View.Top, (1 - progress) * InitialWidth, View.Height)
       Sleep(0)
   Loop
   View.Visible = False
   Return True
End Sub


test.gif
 

LucaMs

Expert
Licensed User
Hm...

I prefer to create a module and a library from this module, so I do not have to create an object, I can use the library as a Singleton.

Apart from that I have to mix the various parts developed (modules, classes, folders scattered everywhere in my PC :p:()... I do not know where to post the final module-library, now :(.

I will delete all the threads :p


And all this for... nothing; members think that this code is useless :D

But I think it is useful, especially to create pop-up menus without having to store size and status (open-closed).
 
Top