When the page is first opened, I want the linear layout to slide to the left and come back after a while because when I swipe, there are two different operations on the right side, I want them to appear for a short time, what can I do for this? Want to do with animation.
Related
I have a Viewpager that show a list calendar of month and when I try to swipe each tab sometime it's hard to go to another tab like when user have to scroll to another page there is 2 possibility:
User have to swipe fast so it will work fine
If user scroll slowly, they have to move the page larger than 50% of the screen to move next or right
So in the second case it make my user hard to swipe between each tab because it take a bit longer just to move between each tab
In recycler view user don't need to swipe larger than 50% of the screen to move the page though
I use CollapsingToolbarLayout in my application. On collapse or expand I fade layout inside. I disabled AppBarLayout.OnOffsetChangedListener when fading is in progress to avoid wrong behavior.
Now when I swipe fast (e.g down and up) my app ignores the second scroll and layout stays faded. When the second scroll ends I want to compare offset before and after the animation and then call callOffsetChanged() or something so it runs through onOffsetChangedListener again.
I am trying to implement a way to have my footer slide away down and my header to slide away up while user scrolls down the scrollview.
And vice-versa, as the user scrolls up the scollview, I want my footer to slide in from the bottom and the header slide in form the top.
Regarding the animation, I have found this good library https://github.com/daimajia/AndroidViewAnimations that comes with a lot of nice animations.
The closest example for what I am looking for, is the default Android Twitter application that makes it's footer disappear as the user scrolls his timeline down and makes it reappear as the user scrolls up.
By header, I am not talking about the Android Toolbar (op AppBar or whatever). It's a customed-made UI element that I want to animate while the user scrolls.
Same thing goes for the footer : it's a customed-made UI element.
While looking for solutions, I stumble upon this answer https://stackoverflow.com/a/28712465/3535408 but it does not work.
Indeed, placing a Log.d inside the ifand else if shows that a simple touch with my finger triggers both a MotionEvent.ACTION_DOWN and a MotionEvent.ACTION_UP event. The same applies as I am sliding my finger up/down making the scrollview scrolls up/down : both events are triggered at the end when I stop touching the scrollview.
Is there a way to improve this solution ? Because as of now, as both MotionEvents are triggered, both animations are also triggered so the result is quite horrible.
Thanks !
An easy way to achieve that would be the following:
place the listview, the header and the footer inside a RelativeLayout
align the header with parent's top
align the footer with parent's bottom
add an empty header and footer to the listview with the same heights
catch the scrolling events on your listview and change the footer and/or header's translationY accordingly
But to answer your question, I'd say you should try a GestureDetector. It's way easier to manage the events - Detecting Gestures
I have to implement slide left and right now playing bar in order to play previous and next song.I have to make whole now playing bar movable after left and right slide.
I have tried implementing ViewPager but due to that I lost Sliding UP functionality of that Playing bar.I have huge code with me.So by making minimum changes in the layouts how can I implement swipe left and right functionality.
Have you checked google music it is doing exactly the same what you are asking for with drawer enabled and viewpager need to used in this case.
Swapping will only do the swapping of the fragment not the whole page..
May it helps you :)
After getting solution to call my splash activity only one time (Part1 Question), Now i have to set up my splash activity.
On My First Layout i want functionality like this :
Image One <--> Image Two <--> Imgage Three --> Second xml(Activity)
Also on every image their will be a page control that will indicate on which image is currently on layout(Like the attached screenshot)/ or can be any other way to show this.
That Means From Image one i can go to image two on scrolling to right(I can come back to image one on scrolling to left) From Image two i can go to Image Three on scrolling right(I can come back to image 2 from Image three if i scroll to left)But if i scroll to right from Third Image then i should get to my Second Activity and never return back on those images.
i.e
I want to have scroll view having those three images with the page controller then after we scroll down to the third/last image on further scrolling to right i want that my second activity should be loaded and the splash should never come up.
Can any one tell me any idea how this can be done.
To make splash sheet with scroll view and page control & switch to second activity when done scrolling.
I don't want animation i want it to work manually like scrolling/ or any other way to implement this.
Coding will be much appreciated.
To implement scrollable images like shown above use ViewPagerIndicator library given HERE. Its simple to integrate and will take few minutes. All you have to do is read the usage section in given link.
For switching activity on last page, simply implement onPageChangeListener described in link and check for page number.