I was curious, since I couldn't really find anything on this, if there was a way to do what happens, when you say have tabs with android, for a normal action button. Onclick on the button, I was curious if there was a way to highlight the bottom of it like the below image. Please give me your thoughts, right now, I can switch the image fine, but I am really looking for just an indication while they are inside that buttons fragment to see as is shown below where movies has the highlighted bar under it. So for my menuitem when they click it until they go back, to normalize it, I was curious if I could get this functionality somehow.
Related
I'm having a toolbar in which I have a menu option so when the guide button from the menu is clicked the guide activity opens but now I want to add a back arrow on toolbar so I can navigate through button clcik and as I see some solutions many of them are suggesting
android:parentActivityName=".UI.HomeActivity" // UI.HomeActivity is where i want to go back
but I don't know why it doesn't seems to work I was not able to see any arrow on the left of the toolbar
and dont know(correct me if wrong) but tbh using android:parentActivityName=".UI.HomeActivity"
for navigating doesn't looks good to me , i was preferring manaul onClick listner on the icon(as image) in the tool bar , but dont know how do i do that
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.
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 am working on a simple application that is supposed to work on 800x480 tablet. Currently:
[][][][]
[][][][]
OOO
These are all buttons and they are working as expected. I, however, need to add menu items to the bottom-buttons. When clicked, menu items should pop up.
-Can I create a menu and place it at the bottom of the screen to replace those buttons? If so, could you show an example, cause I couldn't find any.
-Or, can I add menu items to these buttons?
What You want is an OptionsMenu, if I understand You the right way. I could give You an example later, I am not at home. But for now, look at this example. If You follow this, You donĀ“t need those buttons at the bottom.
http://www.edumobile.org/android/android-beginner-tutorials/options-menu/
if it is not clear, just let me know and I try to give You an example at the evening...
EDIT
for custom menu, You could use PopUpMenu. I had not tried this for now, but I think it is a good solution
http://android-er.blogspot.de/2012/03/example-of-using-popupmenu.html
I have an app that in a certain Activity (drawing) can be in any one of a number of states, such as draw, erase, select, etc.
To enable these states, I've got a button for each in the ActionBar, but one thing I'd like to do is to 'show' the user which state is enabled by keeping the button pressed active or pressed until I turn it off (when they have switched state by pressing one of the other buttons).
Searches here and other places have me coming up blank... can anyone recommend a possible solution? I've though about rolling my own toolbar, and while this might be my final solution, using the ActionBar would speed things up greatly at this point.
Thanks.
There is no direct way to do that, as far as I know, but you could implement your custom component to do that. However, my advice to you is having a separate toolbar that's not on the action bar, since the users expect all buttons on the Action Bar to be "Action Items" which perform something immediate, so having toggle items on the Action Bar might break this expectation. This allows you to save space on the action bar for things that the user expects to see there like: navigation, "Undo", "Save", "Delete"...
I agree with Bruno about the fact its probably best if you do it in a separate toolbar for the sake of user experience standard and your code will probably look better because you cant fully customize the action bar but if you do decide to go with it i can think of something really simple like, when clicking one of the menu buttons you set the pressed button to a new drawable (pressed button) and the others to their normal drawable (not pressed) so each menu icon will have a pressed and not pressed icon. you will have to invalidateOptionsMenu though.
I had the same problem and did not find a solution. However, I found a workaround that works for me:
In the onOptionsItemSelected(MenuItem item) method, if item is the button you want to toggle, simply call item.setIcon() and point to another drawable. I use the same image but with another color to show the user that the button is in "pressed" state. And when the button is pressed again, revert to the original drawable.