Android Question Hide/Show a view when onScroll from a ListView is called

Discussion in 'Android Questions' started by Walter Adriano da Silva, May 29, 2015.

  1. Walter Adriano da Silva

    Walter Adriano da Silva Member Licensed User

    Is there a way hide or show a View or the ToolBar through ListView.onScroll method()?

    Following an example

    [​IMG]

    This example use a RecyclerView, but I need do this with a ListView

    Example source: https://github.com/mzgreen/HideOnScrollExample
     
  2. LucaMs

    LucaMs Expert Licensed User

    Uhm...

    ListView has not an event on scrolling.

    You could use CustomListView and set the height of the label "HideOnScrollExample" based on the position you get in ScrollChanged event of the scrollview.
     
  3. LucaMs

    LucaMs Expert Licensed User

    You should add this routine to CustomListView:
    Code:
    Private Sub sv_ScrollChanged(Position As Int)
        
    If SubExists(CallBack, EventName & "_ScrollChanged"Then
            CallSubDelayed2(CallBack, EventName & 
    "_ScrollChanged", Position)
        
    End If
    End Sub
    so you can handle the ScrollChanged event in your Activity.
     
  4. inakigarm

    inakigarm Well-Known Member Licensed User

    Last edited: May 30, 2015
  5. LucaMs

    LucaMs Expert Licensed User

    I don't know.

    However:

    1) I don't like that way of disappearing of the label :)
    2) I think that to get the same effect, you should put the label in a second scrollview and synchronize the two scrolling.
     
  6. Walter Adriano da Silva

    Walter Adriano da Silva Member Licensed User

    I will try the CustomListView.

    Thx Luca
     
Loading...
  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