childview in scrollview click delay after scroll - android

I have a webview inside a scrollview with javascript listening click event.
It is no problem to listen it in normal case but cannot be listen just after scroll. I need to have a first click to stop the scroll and click one or two times to trigger the click event. Or wait a while until the scrollbar fade out.
I have done a research and know it is normal behavior of scrollview. I have try to set a ontouchlistener on webview to requestDisallowInterceptTouchEvent(true) but just make it cannot able to scroll anymore. Is it there are any approach to cancel the scrolling and perform a click at the same time with no delay in a scrollview?

Finally, I have solved it by reading the document. I just put android:descendantFocusability="blocksDescendants"
in the main child view of scrollview and then solve my problem.
For Gopal Singh Sirvi asking, I think you need to put a webview in a scrollview in some cases. Let say the data of one section contains html code. I guess the content page of gmail is also like this. (After open show layout bounds, the content seems inside a webview but others not)
Hope this help!

Related

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.

Avoid refresh android scrollview elements

I have a Listview with inside some elements (a button and an edittext). I was able to disable the button after the first click on it. My problem is that if I scroll the list, and then return upside, my button is again enabled. While i'd like that It will not change his state if I don't change activity.
So I think that there is a kind of refresh when you scroll the list....how can I avoid this??
Please help me!!!
Example something what you want

Scrolling Functionality

I need to implement a UI like this:
In the above screen row needs to be scrolled horizontally and columns need to be scrolled vertically.
I have not used Gallery as It is being deprecated. Here are some scenarios which I have tried:
1. Combination of GridView and ListView.
2. Combination of ListView and Horizontal ListView(Custom Component).
Option 1 did not work for me but I could make it with option 2.
With option 2 perfomance is not good.
Solution: I am thinking of implementing 4-5 horizontal listviews inside scrollview with Gestures so that I can handle the vertical swipe thru code or by subclassing the ScrollView and overriding the onScrollChanged method.
But I am looking for some more optimized solution.
Any help is appreciated.
Thanks
Use webview and push the content into it through JS hooks.
I have gone with my solution if anyone can suggest a better solution then obviously I will go with it:
Solution:
Implemented 4-5 horizontal listviews inside scrollview with Gestures
and handled the vertical swipe thru code or by subclassing the
ScrollView and overriding the onScrollChanged method.

Prevent onFocusChanged firing when ScrollView is scrolled

I have a problem where I have several TextView objects in my Activity. More than can fit on the screen view so I have placed them inside a ScrollView.
Now each TextView item is placed into a RelativeLayout before placing onto the ScrollView.
Each RelativeLayout object then has onClickListener and onFocusChangedListeners assigned.
Each Listener implements a method that pops up a dialog to enable the user to edit the value stored by the TextView.
The problem that is occuring is that when the screen is scrolled the onFocusChangedListener event is fired causing the dialog to appear for several items at a time.
Is it possible to detect if the Scrollview is scrolling and prevent the onFocusedChanged event firing?
I can post code if required but its quite large as the items added to the page are done so dynamically. This also means there is no xml for the layout.
I looked at using the ScrollView onTouchListener to add a flag ignoreFocusChange but it appears this would not work as the event was hit sveral times for one swipe/fling on the screen.
Please help
Regards,
Iain
After spending some time on this I found that the best solution for me was to remove the onFocusChangedListener and replace it with onTouchListener

handle click event for image inside scrollview

I have a set of images inside horizontal scrollview. I want to perform click event on these images. I have added onClickListener to the images. But its not working. I think since images are inside scrollview the problem arises. Can anyone help on this issue?
I used OnTouchListner instead of OnClickListener and applied it to the images inside ScrollView. Now I am able to do it.
#Desiderio : I used ScrollView for some other purpose. I required it for my appn. It doesnt interfere with my pbm. Sorry, I made mistake while explaining my pbm.

Categories

Resources