Ignore Button Existence When Swiping On Android ViewPager? - android

I was wondering if there's a way to ignore buttons on the view pager when swiping. For instance, I have a panel of buttons located at the bottom of the screen and the users may swipe left or right to display more of the buttons available. The problem I'm having is that the margins between the buttons a relatively small compared to the buttons themselves so more often than not I'm on a button when swiping, which the viewpager does not respond to so I have to go back and try and get inbetween the buttons with my finger and then swipe. Is there a way to prevent this from happening?

Related

How to detect screen tap on non-clickable and swipe-able area alone in Android?

My use case is, that I need to hide the toolbar and bottom navigation view after a delay and reveal it once the user taps anywhere on the screen.
But I shouldn't reveal those when the user touches the screen to click on a View/Compose or when the user performs a swipe/scroll gesture.
I achieved this partially using GestureDetectorCompat.onSingleTapConfirmed. The gesture detector doesn't call this method for swipe gestures, but it calls this for click events for clickable views/compose inside the screen.
So when I click an actionable icon in the screen, that click action is executed and the toolbar and bottom bars are revealed. I need to ignore the tap events when the tap occurs on a clickable view/compose.
I mention as view/compose because, my project has both XML-based views and Compose views, so the solution should work for both click events.
Any help is much appreciated, thanks.

how to control Android ScrollView to go all the way to top or bottom but never middle?

I have a fragment with a scrollview that holds a long layout essentially representing 2 different sections that are related, what I want is to control the scrollview so when the user wants to scroll down it always goes all the way down and can never be in the middle so it will never reveal partially the top or bottom parts, same effect backwards when you want to scroll up it just takes over and goes all the way up to reveal the top section of the layout fully.
It is basically how a vertical viewpager will behave but contained within a single long view.
I know how to programatically scroll up or down but I don't know how to avoid the user scrolling to just the middle, I'd like to hook up to some scroll event, detect the direction and go fully in either direction.

android animating views between pages

I have been researching for the same since two days. Here is what i want to achieve. I havent ever tried much animations in android so please clear my approach wherever required. I will have two pages/screens (one visible at a time) Now when I am on page1, on swiping right to left page 2 will be displayed (achieving this is not that difficult) But here is my problem : when I am scrolling to page2 i would like to animate/translate/slide an image from page1 to page2 (without touching the image) and let the image sit on page2. I am just not sure of how to start with this.
I have thought of few ideas
First: I think i should implement a layout larger then window and then do the required animations and scrolling in it using horizontal scrollview.But now here I am not sure how will I make it look like they are 2 different pages(concerned about handling different screen sizes)
Second:I have seen example libraries of draggable gridview viewpager. But here both of my pages will have different layouts
Third:I am thinking of dividing both of my pages. the lower part of my pages will contain framelayout where I will only change the framelayout's content on scroll and perform hide n show trick on the upper part.But here again the trick is how am I supposed to place the image(contained in framelayout) to upper layout with an animation(image sliding to the top side on its own kind of animation)
Any Ideas. Any views/suggestions. Need all of it.Thank You for your valuable time.
This happens when I am trying to move the image to screen's top-left position. It moves in the left top direction as shown in the images below..
This happens when I am trying to move it besides second fragment textview
But the problem is I want to move it besides second fragment textview while scrolling and when scrolling is done it should come to top left of the screen just like the second fragment textview

Swiping to make ImageButton disappear / appear

I've a menu in Android app with several ImageButton (all grouped in a RelativeLayout) and I would like to make it disappear when swiping with finger towards the outside of the screen.
Swiping with finger towards the inside of the screen, instead, the menu should re-appear.
Any suggestion to do this ?
Try writing a gesture detection as given here Fling gesture detection on grid layout and in that code instead of toast write your code.

android horizontal scrolling with buttons

Hi im wanting to create a function that allows the user to swipe left and right and a button slides in horizontally. for example there will be a big button on screen when you swipe it moves horizontally and another big button could anyone point me in the right direction as i have no idea where to start with it?
heres an example of what i'm looking for
you can use viewpager: http://developer.android.com/reference/android/support/v4/view/ViewPager.html
and when the current page changes (there is a listener to do this) you can change the circle images at the bottom to show the properly page.
:)

Categories

Resources