For those of you who have used the Facebook app, it has an interesting way of showing more information on the home activity by having a draggable view at the bottom of the screen that, when dragged up, shows Facebook notifications. Dragging the same view back down hides the notifications. Note that this will work either by holding and dragging it to the top of the screen or simply flinging it in that direction.
I would like to do something similar for my app. I have a LinearLayout at the bottom of my activity and want to be able to drag it up to see more information. How can I go about doing this? Are there any tutorials available?
Have you checked out the sliding drawer component?
http://developer.android.com/reference/android/widget/SlidingDrawer.html
I think this might be what you are looking for.
Related
The goal is to obtain views that can be interacted with instantly (that can be clicked right now and something would happen). If the view is visible and clickable in general but hovered by another view/menu/side panel, it should be omitted.
Voice Access do that. And it seems to use Accessibility API.
The perfect example is the bottom menu in Google Maps. When it expands, "Search along the route" button underneath is still visible but it's not highlighted by the app.
So what do we have?
There is a stream of AccessibilityEvent. The most useful is
AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED, so we can be notified when something is happening.
With getSource() we can get an instance of AccessibilityNodeInfo that triggered the event.
Or we can get a root of a window with AccessibilityService.getRootInActiveWindow(). And having that we are able to traverse the whole hierarchy within an app.
AccessibilityNodeInfo doesn't provide any information about z-order of views, so it's not possible to understand what is above and what is beneath.
The bottom menu is in the same window (it's not modal).
If you try to click "Search along the route" button while the bottom menu is expanded, the bottom menu collapses. So you can't actually click it, it's beneath the menu.
I've looked through all parameters of the AccessibilityNodeInfo, like isVisibleToUser(), isClickable(), isContextClickable(), isSelected(), isFocusable(), isFocused(), isAccessibilityFocused() and the button has the same parameters when the bottom menu is collapsed/expanded. It's visible to the user, focusable and clickable.
I've looked into hidden APIs and don't see anything that can be useful.
What I'm missing?
The key point is that in an AccessibilityService.onAccessibilityEvent() the tree hierarchy is not final. To get views that are interactable at the moment, AccessibilityService.getRootInActiveWindow() should be called with a delay.
AccessibilityNodeInfo#getDrawingOrder() will probably help you. Note that you need to do tree traversal to determine what is on top of what.
There are still corner cases with transparent views that will give you trouble, but that should get you 95% of the way there. We're working on a better answer for that case.
in an android application, I need to do the following:
I have a view, that acts like a menu, I can slide it from the bottom-up.
However I want to have 3 states: closed, half-opened and opened.
Please refer to this pic:
The blue section is the Handle, the user will use it to slide up/down or fling...
This is a bit similar to the android 5 notification bar, where you drag down to reveal half the view, then another drag down will reveal the whole view.
I can start implementing it in the onTouch of the blue section but that would require me to handle a lot of cases, especially the ones where the user flings vs slowly drag....
Is there any easier way or library that can help?
Thank you very much
I have a news app.It is supposed to launch by swiping on the screen(homescreen or while in any other activity like switchr app).I learned to code swiping patterns but in my case I have to do exactly in the following way(swiping bottom right to top left)..Kindly have a look over following pictorial representation
1.Firstly app should launch by swiping bottom right to top left on the screen
2.next,show the user with list of scrollable arc menu buttons embedded in it like second image
3.when a user clicks on particular button it has to show a brief description about the content like third image
my problems:
creating arc like scrollable menu on bottom right side of the screen(I googled sia ahmed's solution over here ,it helped me a bit)
creating that parachute like structure(image 3) when user clicks particular bubble like button in arc menu..
please guide me
For the menu check out arcmenu by daCapricorn on github. Also see this question.
The balloon bit is trickier. I know of a balloon hint code for android but i haven't seen it in action.
Hope this helps!
I'm trying to make an extra effect to menu that will come down from the top of the screen
I want to make it enter the screen while swiping it from the top and if the user left it, it should continue to the end
this is the figure that demonstrate what I want to do:
I tried to do it with animation but the animation will not go on while swiping and it will go to the end without touching
any other ideas to move the view down with finger ?
Check this out for a sliding Drawer http://developer.android.com/reference/android/widget/SlidingDrawer.html
it sound like you kind of want the same thing as the pulldown menu at the top of all android phones except you want it customized, the link will show you that.
OK
It works for me now
I used SlidingTray.java class from this API
API Website
btw : this api open source
Does anybody know how to implement an expandable view which behaves like the status bar?
I've seen it in many apps, so I assume it's not too difficult :)
SlidingDrawer might be what you're looking for.
From official docs:
SlidingDrawer hides content out of the
screen and allows the user to drag a
handle to bring the content on screen.
SlidingDrawer can be used vertically
or horizontally. A special widget
composed of two children views: the
handle, that the users drags, and the
content, attached to the handle and
dragged with it.
I suppose that you are asking about Notification
A class that represents how a
persistent notification is to be
presented to the user using the
NotificationManager.