Android SlidingDrawer Position Handle Offscreen - android

Is it possible to position a SlidingDrawer so that the handle is just below the bottom of the screen?
The functionality that I'm going for is that a user will press a button (not attached to the drawer) to slide the drawer up from below the screen. From there the user is able to use the handle to slide it back down.

Use View#setVisibility(View.GONE) and View#setVisibility(View.VISIBLE) on the handle.

Related

Disable the swipe gesture that opens the navigation drawer for a certain view inside DrawerLayout

I have a root DrawerLayout in the android layout swipe left to right on anywhere on the screen.
The problem here the layout includes a board that requires moving a piece from left to right by sliding, so when a user tries to move the piece, the DrawerLayout opens up. the board only covers only half of the screen, so I still want to allow the drawer to open when the user swipes on the other views,
Is it possible to not trigger the drawer when the user swipe on a particular view?

Scrolling a ViewPager programmatically, by a small amount

I have the requirement for what is effectively two activities side by side, allowing the user to scroll from one to the other, and back. I've decided that ViewPager is probably the best way to handle this, but am open to suggestions.
When the activity loads, the left hand view is displayed. I want to indicate to the user that the other view exists, by just scrolling it a small amount to the left and back again (similar to the way it's now common to show that a sliding drawer menu exists).
I've tried a number of things but have yet failed to find a method where both the views scroll smoothly together. Another way of interpretting the requirement is saying I want to programmatically fake a user flicking the page briefly.
Try calling the method fakeDragBy(float)! According to the documentation you need to first call beginFakeDrag() to initiate it and then call endFakeDrag(). This will mantain the ViewPagers default snapping behavior, so once you've revealed the other screen is there you don't have to animate the transition back, simply call endFakeDrag and the ViewPager will correctly snap back to the last screen (As long as you haven't dragged it past the half-way mark).

Handle ViewPager swipe inside Navigation Drawer

I am using ViewPager inside my Navigation Drawer and am encountering an issue when I want to swipe to next tab in ViewPager. Swiping works in direction which opens Navigation Drawer but doesn't work in direction which closes Navigation drawer.
That means I can normally swipe to ViewPager pages to "right" direction but when I want to swipe to the "left", NavigationDrawer intercepts touch events and closes itself.
I would still like to have ability for navigation drawer to close if user swipes on content which doesn't have horizontal scroll. How can I accomplish something like this? Thank you.
use View.requestDisallowInterceptTouchEvent(true); when you do not want your ViewPager to close, call this View.requestDisallowInterceptTouchEvent(false); immediately after Action_Up.
What it does is it prevents the parent from listening or intercepting the touch event.

How do i add swipe functionality to a button?

I want to show a button in a view.. If I swipe it left/right, I want to be able to get the next button.. How can I do it?
Each button represents an option of a menu..
Swiping should only work on the button.
The ViewPager class allows you to implement horizontal swiping through menu items. It can be set up to work on just on a small area of your Activity. You would use a fragment containing just a button in your case.
Take a look at this post on the Android Developers Blog for an example.

Swiping in order to call another Activity in Android

I want to make something like transitions between ViewControllers in iOS 7 but in Android, is it possible?
Explanation: please look at image below, I have main Activity which has ViewPager inside, so we can swipe between Fragments. I want to call another Activity (or Fragment) from each Fragment (blue on image) swiping to bottom or to top but this action should be done smoothly like in ViewPager.
You can intercept swipe up and down gestures and set items in viewpager accordingly. Please read this guide on how to intercept swipes in various directions.

Categories

Resources