I am working on a search which has a listview And at the bottom and I want that list View To hide when the scrolled up and view again when scrolled down and it would be good if it is animated and as I am using the same layout for multiple activities. I would prefer to make changes in the XML file. pl refer the screen shot screen Shot
Asked
Active
Viewed 550 times
0
-
This might help https://guides.codepath.com/android/Handling-Scrolls-with-CoordinatorLayout – Tabish Hussain Dec 14 '16 at 08:00
2 Answers
0
I think this answer basically answers that question. Haven't tested it but logically it works. In the /* do something */
area for the listView.setOnDetectScrollListener(new OnDetectScrollListener()
just change the visibility of the search layout.
The link to the forum is here.

Community
- 1
- 1

BrendanOswego
- 1
- 1
-
Thanks for the answer but it would be comfortable if there is any default way to do that hiding and view that search – qwertygamer Dec 14 '16 at 08:33
-
Changing the Visibility will not look good on the app is there any other way to perform a simple animation @BrendanOswego – qwertygamer Dec 14 '16 at 08:42
-
-
I want animation to Move up and hide while pulled down and move down while pulled down @ BrendanOswego – qwertygamer Dec 14 '16 at 09:01
-
I added a new comment, easier to do it that way with adding code segments for me at least. – BrendanOswego Dec 14 '16 at 09:02
-
0
@qwertgamer so for the animation you need a few things,
A XML file in an
anim
Folder inside yourres
Folder and call the file something likesearch_animation.xml
.Mess around with this code a bit but this is the general concept of what you want to do with it:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="0%" android:toYDelta="-100%" android:duration="600"/>
</set>
- For the scrolling events you need to create an Animation by doing something like this
Animation anim = AnimationUtils.loadAnimation(getActivity(), R.anim.animation);
anim.setInterpolator((new AccelerateDecelerateInterpolator()));
anim.setFillAfter(true);
YOUR_SEARCH_FRAME.setAnimation(anim);
anim.start();

Ziad Akiki
- 2,601
- 2
- 26
- 41

BrendanOswego
- 1
- 1
-
ALSO, have another animation.xml file that animated from off the screen -> to the screen and basically switch the values of the 'android:fromYDelta' and 'android:toYDelta' values – BrendanOswego Dec 14 '16 at 09:05
-
I tried what u gave me the hiding part worked perfectly but the animation got messed up. It's supposed to animate from its layout to the hide inside the Activity bar but it starts from the middle of the listView and ends at its own layout. @BrendanOswego – qwertygamer Dec 14 '16 at 13:14
-
Thanks... For the Help, i resolved the issue With the Default animation search.animate().translationY(search.getHeight()); – qwertygamer Dec 19 '16 at 07:51