0

I need display a Layout on botton of ScrollView such as:

1 - If the height of the content of the ScrollView is less than the height of the ScrollView, the Layout should be at the bottom of the ScrollView

step 0

2 - If the height of the content of the ScrollView is greater than the height of the ScrollView, then the Footer Layout should hide and only show Title.

step 2

  1. When user scroll up to end of content, then Layout footer also scroll follow content.

step 3

stop 4

PS: I'm using scrollview and must use it for my project.

Nam Vạc
  • 119
  • 2
  • 10
  • I think this has been covered previously [here](http://stackoverflow.com/questions/13277785/how-to-have-a-fixed-footer-with-scrollview-in-android). You can set `fillContentView` on your `ScrollView` to make sure it takes up all the available space. – Ali May 02 '16 at 12:23
  • I think my question is more complex. The problem is how to scroll footer follow content of view scrollview of case 3, please read the question carefully. Thank for your reply! – Nam Vạc May 02 '16 at 12:32
  • You have to use tricks here. I would have 2 footers, one is visible when you scroll to the end of the list, the other is visible when you are not at the end of the list. You can monitor the location of the footer which would be the last view in your ScrollView and when it becomes visible (y-coord is the same as the screen height in pixels, plus the height the of footer view) make the footer which is fixed on the screen `GONE`. This may sound silly, but I've done similar stuff with snapping stuff to the top of the screen when scrolling and it looks surprisingly smooth. – Ali May 02 '16 at 12:37
  • i has read a tutorial that way, but i dont remember the link. Can you share it with me? haha – Nam Vạc May 02 '16 at 12:48
  • Sorry, dont have any links, just set an `onScrollListener` and in that get the x and y coords of the footer at the bottom of the listview, once the layout is done (register a global layout listener) get the x and y coords of the footer on the screen. If the x and y of the footer at the bottom of the scrollview is less than or equal to the x and y of the footer at the bottom of the screen, show the footer at the bottom of the screen, else, show the footer at the bottom of the ScrollView. – Ali May 02 '16 at 12:53
  • 1
    ok, i''ll try, thank you so muck. i''ll share my code if it work! – Nam Vạc May 02 '16 at 12:57

0 Answers0