I am using Horizontal scrolling in my application at some condition i don't want my horizontal scrolling to occur. so can any one help me how to disable the horizontal scrolling.
You should add another layout in your main view , and give requestFocus() to that view.
so your scroll view will get disable.
This solution work for me in my app.
Related
How to properly scroll to a position in nestedscrollview which is inside a coordinate layout? When I use scrollTo(), it seems like the view inside AppBarLayout is loosing the ability to scroll down when I scroll to the end of NestedScrollView and coming back to top. What I need to know is how to programtically scroll to a position in nestedscrollview without causing problem with the normal behavior of collapsing layout.
Issue is similar to what is mentioned in this post:
The Coordinator layout doesn't Scroll up for a specific position
There is a Gif attached along with the above question:
https://i.stack.imgur.com/uSGfX.gif
I have tried the solution in above link, but it is not working.
Beneath my RecyclerView is a Button. The RecyclerView´s height is set to wrap_content, so when there are a lot of items it takes the full screen and when scrolling to the bottom the Butten is not visible.
I solved this with wrapping these two views inside a ScrollView. This works almost but when scrolling to the button and then up again the RecyclerView start to scroll first while the button is still on the screen. So I needed to disable the scrolling from the RecyclerView itself. I solved this with setting android:nestedScrollingEnabled="false"
.
This seems to work but now I have another problem. When having a lot of items the RecyclerView does not show all items only the first few items. This happens with disabling nestedScrolling, when I turn it back on it displays all items again but then I have the previously explained problem.
Any ideas what I can do?
In case anyone is having the same problem: The solution is to use NestedScrollView instead of ScrollView
I have an HorizontalScrollView in my design, which I populate with a variable number of items. The problem I have is that sometimes I populate it with many items, so the ScrollView shows scroll bars. That's OK, but I would like to check this situation and show a Previous and Next buttons in this case.
How can I do this?
I don't think ScrollView has a scroll listener. Synchronise ScrollView scroll positions - android might help you for creating a custom one.
In my android app, I first programmatically layout a bunch of textViews, in a layout view, then I immediately programmaticallly scroll to a specific textView. Scrolling is not working. I suspect it is because Android has not finished computing the location of things. Scrolling works if I wait between layout and scrolling. I spent the whole day finding a solution. Please help. Thanks.
Default textview can't scroll.
If you want scroolable textview you should use scrollview then add in scrollView,TextView.
Don't add in layout textView. You must add ScrollView.
I was wondering if it was possible to set the scroll range of the android ScrollView. Basically I have a scroll view with one child in it that extends 100 pixels past the bottom of the screen. Normally the scroll view will scroll till it gets to the bottom of the child view, is there a way to get the scroll view to stop scrolling like half way and not show the whole child view? I have tried extending ScrollView and overriding the computeVerticalScrollRange() but that did not work. Any help would be appreciated.
Thanks,
Sam
Do you want it to only sometimes scroll to the bottom? Or never at all? In the case of the latter, I would suggest reconsidering your layout and removing that child from the scrollview parent.