How to find is button reachable for user or no - android

Simple question but I can't find solution.
Default data: I have some Button among other buttons. Buttons are in the LinearLayout and then in the ScrollView.
Situation: ScrollView was scrolled, button is not on those part of screen which user can see now.
StackO suggests me only getVisibility() method, but programmatically button is visible!
How can I understand see user button or no - is button on the visible part of the screen for user or no?

Related

ScrollView does not come back to the beginning of layout - Android

How do I make a ScrollView always come back to the beginning? I have a ScrollView, and inside it a LinearLayout (vertical) with a TextView and a Button called "next". This button changes the TextView text, however the text is not shown at the beginning, but always of where it was visible on screen when the button was clicked. The user then has to scroll to see the beginning of the text.
Is there a way to make the ScrollView go back to the begging when the button is clicked?
Thank you
Just call scrollTo(0,0) on your Scrollview.

Start animation if view is in focus

I have a android app and with several Textviews inside linear layyout which is inside scrollview. On a button click I can bring focus and animate any textView (like move left to right). But What I want is, On Scrolling, if a TextView has Focus, animation for this textView should start. Just like this website.
I have an idea, which is: If scroll changes, check textview.hasFocus(), if true then startAnimation. But I don't know which method to use for checking 'if page scrolled'? I don't even know if this is right approach? Please help.

how to manage onTouchListener and onClick at a time

I want to detect gesture on my ScrollView and its childs . I wanna have all those onClick method working as well. Say there is a button surrounded with LinearLayout and the whole thing is surrounded with ScrollView . I wanna call an action when user swipe anywhere of the ScrollView..
I applied onTouchListener to ScrollView.. But as the LinearLayout is clickable, event isn't fired when I swipe over the linear layout.
and if I set touch listener to all those child view, then onclick doesn't work.
remebmer using facebook lite ? user reads, scrolls news feed taps "like" button. clicks on links.. But still it can show chat list when user swipes from right to left on any part of screen.. how do they do it ?
You don't need onTouchListener to do this job for you. Use onScrollChangedListener. See this answer for more info Can I have onScrollListener for a ScrollView?. This question has been answered many times all over internet.

Button Click Delay inside ScrollView

I have an android activity that takes up more then the full screen so I place it inside a ScrollView. There is a button at the very bottom of my Activity and when I scroll down there is a delay in which I can click the button. The delay is until the scrollbar fades away and then the button can be clicked.
This is not a very long time, but for a user it may seem like it and it is very annoying so is there a way to make the buttons clickable while still scrolling or make that time shorter at least?

Android: nested links inside of clickable layout

Here's scenario:
I have a RalativeLayout holding ImageView and few TextViews.
There are "linkified" elements inside these TextViews such as URLs, phone numbers, etc.
Clicking on the links result in various actions, also clicking on ImageView triggers some action too.
Now - I want to have outer onClick attached to the complete area of RelativeLayout in such way that if user clicks on any spot withing the layout (but outside of the image and links) then it executes another action
Right now I have layout#onClick, image#onClick, and embedded links are processed by Linkify. Image and links clicks are working reliably but clicks on layout are captured about 50% of the time and I suppose would frustrate users to the point of tears. Any tricks that you guys can suggest to improve reliability? And if not what would be a good way of achieving this from the best usability standpoint?
Since no one came out with answer at least I can share my thoughts about the solution. Basically I decided not to fight overlapping click handlers and instead, start with onClick enabled on the parent. Then, when the parent detects the click it turns it's own focus off and lets other controls take care of clicks. I also added "Off" button that is visible only when parent is expanded and clicking on that collapses the parent and puts the focus back into the parent view.
Let me know if you know better solution

Categories

Resources