B4A Library [Class] ExpandViews

Discussion in 'Additional libraries, classes and official updates' started by LucaMs, May 20, 2018.

  1. LucaMs

    LucaMs Expert Licensed User

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


    The initial code was here:

    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.

    Attached Files:

    Last edited: May 20, 2018
  2. LucaMs

    LucaMs Expert Licensed User

  3. Erel

    Erel Administrator Staff Member Licensed User

    Cross platform collapse view:
    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(0View.Left, View.Top, (1 - progress) * InitialWidth, View.Height)
    View.Visible = False
    Return True
    End Sub

  4. LucaMs

    LucaMs Expert Licensed User

    Damn, now I should update the other module/lib (and thread) :mad::p

    BTW, you used a not so nice image :p
  5. LucaMs

    LucaMs Expert Licensed User


    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).
  6. LucaMs

    LucaMs Expert Licensed User

    Well, I decided: I do not do anything else, wasted time.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice