Recently I implemented the sliding menu library. It is working fine but the problem is by default, the secondary menu(the layout on right),if not open, slides in when its clicked.
What I want is that the click event should be passed on to its children so that the views inside the secondary menu can get click. The user can use swipe gesture to open the secondary menu.
All the answers I've looked at, are meant to disable swipe gesture on the secondary menu and not the click. So, it will be helpful if someone can provide some suggestions :)
You need to update the library to update the default behavior of Sliding menu.
You would have to go into CustomViewAbove class and change the onInterceptTouchEvent method.
Remove mQuickReturn = true; in MotionEvent.ACTION_DOWN:
Related
In my android studio, I am creating animated floating button, in which on click it expands to multiple floating button again on click it collapse. "https://www.sitepoint.com/animating-android-floating-action-button/"
The part where I need help is if the buttons are expanded and the user instead of collapsing the button its touches another part of the screen or clicks something else then I can detect and collapse it programmatically.
What method should i use to do this?
You can use third-party library to save your time. I recommend this one
Check it out and I hope that it will be useful
In my android app I have a jfeinstein sliding menu , I enabled the sliding gesture to show and hide it.
In one of my activities I have a google map, but when I touch the map to navigate into it, if i slide my finger from left to right, the menu appears and the map doesn't move.
Is there a way to prevent the menu from sliding in and 'pass' the touch event to the map in order to let the user navigate it?
There are two ways to resolve your issue:
The easy way - sliding menu way, is to use the methods within the library and disable the sliding menu on certain activities/fragments. This is achieved by using the setTouchModeAbove
// Allows the SlidingMenu to be opened with a swipe gesture on the screen's margin
mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
// Denies the SlidingMenu to be opened with a swipe gesture
mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
// Allows the SlidingMenu to be opened with a swipe gesture anywhere on the screen
mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
The most general solution would be to use onTouchIntercept method to decide is a touchevent should be passed through another view or it should be consumed by that viewgroup. The internet has enough examples addressing this.
I wanted to achieve the same sort of functionality found in Google Now where you can tap the cards overflow icon and a menu appears next to it with options (shown here).
Does anyone know how to implement this sort thing to achieve the same style etc?
I think you can do this by placing a listview under your button, and set its visibility to invisible.
Then place an onclicklistener on your button to turn your visibility to visible.
Is it possible to create a menu in android that shows when someone for example touches a graph and It brings more options. I want a menu that will appear from above and below like how the menu used to be in android when you touch the menu button. Now without the button i would like the user to touch a chart or a table and two menus appear from above and below or even sides. Any suggestions will highly be appreciated
Suggestion:
Make the layout of menu you would like to show, and include it in the layout of your activity.
By default set it to be GONE, this will hide it.
Then set a touch listener for your graph, and change the visibility of menu to VISIBLE to show it.
I think what u need is a context menu; see this example Hope this helps :) cheers :)
I have a custom sliding drawer that basically has very same traits as a options menu. I wont get into why I'm not using an options menu at this time as its beyond the scope of this question (long story short - it won't work).
The drawer sits on top of a view pager so users can swipe between various fragments to interact with the various aspects of the application. I want to be able to detect when a interacts/engages with anything OUTSIDE OF the SlidingDrawer. If that happens I want to automatically close the sliding drawer.
I've tried listeners, event listeners, gestures, gesture listeners, etc and I cannot seem to get this magic potion to work. Anyone have any ideas/tips/tricks?
Have you tried overriding the
public boolean dispatchTouchEvent(MotionEvent ev)
This method is inherited from the activity, so you should have access to it.
You didn't post any source code, so I can tell for sure that it'll work. Please try and let us know.