I want to make the same implementation a pulse application.
Horizontal list view inside a vertical list view.
i tried this project for horizontal list view, but when i am trying to scroll horizontal the vertical scroll active and the list is goes up and down.
how can i prevent this issues.
it's work on my app...
just like pulse app... horizontallistview inside vertical listview
this is the solution...
just put this code in u'r onscroll of HorizontalListview class...
ViewParent viewParent = getParent();
if (viewParent != null) {
viewParent.requestDisallowInterceptTouchEvent(true);
}
It would be much easier if you paste your piece of code with your question, allowing to see why it goes wrong. My best guess without this information is to check you usage of fill_parent vs wrap_content.
i think you should use some horizontal scrollviews in a vertical scrollview. and in each horizontal scrollview, you can give listview, gridview, etc... if you want. I think it's better solution for this problem. :)
Related
I'm trying to make an activity which works similar to this one from the Google Play Store.(https://vid.me/zfnV)
I tried it with a NestedScrollView in which I had a Textview and other things like a button. The vertical scrolling for this works fine. Now I would like to have some Cardviews which are horizontal scrollable in the same activity.
Any suggestions or tips about how to implement something like this?
you could do something like this
put a RecyclerView with LinearLayoutManager.HORIZONTAL as parameter for the element you want to scroll horizontally
as parent of RecyclerView put NestedScrollView
not that we should never put a scrollable view inside a scrollable view unless we set the height of the second scrollable view which is your RecyclerView
see this post it will help you implementing this solution :
note that
How to use RecyclerView inside NestedScrollView?
Good luck
I have a layout which has some some TextViews and ImageView on the top of the screen and a GridView. You know GridView has own scroll and GridView's ScrollListener says me firstVisibleItem, visibleItemCount and totalItemCount.
My problem is that when I want to scroll my layout from the top, I have to put my all layout into ScrollView so my GridView(ExpandableHeightGridView) does not get the correct itemcounts. If I dont put a ScrollView, I can't scroll from the top.
How to deal with this problem? How can I scroll my all layout from the top.
Remember, my major problem is getting wrong itemcounts. I want to load more items when scroll reachs at the bottom so I have to read itemcounts.
Thank you to all.
It's not a good idea to have two scrolling containers one in the other. I'd expect the GridView to misbehave when it's inside a ScrollView.
The cleanest solution to your problem would be to use the concept of ListView's addHeaderView(). As GridView doesn't support headers though, you'll have to use another Google's class, namely HeaderGridView: https://android.googlesource.com/platform/packages/apps/Gallery2/+/idea133/src/com/android/photos/views/HeaderGridView.java
I want to learn how to solve this problem. I want to have a Horizontal scrollview with the scroll blocked (the user should not be able to scroll it) and inside that horizontal scrollview i want to have another horizontal scroll view, and this scrollview must be able to be scrolled by the user (it haves more content that the width of the screen).
Is it possible to do it?
I tried using this on the parent horizontal scroll view:
((HorizontalScrollView) view).setHorizontalScrollBarEnabled(false);
((HorizontalScrollView) view).setEnabled(false);
((HorizontalScrollView) view).setFocusable(false);
((HorizontalScrollView) view).setFocusableInTouchMode(false);
and this on the child horizontal scroll view:
((HorizontalScrollView) view).requestFocus();
It is not working, the child appears to have a scroll bar, but it cannot be scrolled.
How can this be solved?
PD: I know that this is not a good practice, but I want to learn how to achieve this goal.
You should never use a
HorizontalScrollView with a ListView,
since ListView takes care of its own
scrolling. Most importantly, doing
this defeats all of the important
optimizations in ListView for dealing
with large lists, since it effectively
forces the ListView to display its
entire list of items to fill up the
infinite container supplied by
HorizontalScrollView.
http://developer.android.com/reference/android/widget/HorizontalScrollView.html
UPDATE:
Since you may be forced to use a two dimensional scrollview, you may consider using this:
http://blog.gorges.us/2010/06/android-two-dimensional-scrollview/
I haven't used this but it may be a reasonable approach.
you can do it. But you have to handle child layouts in scrollview i.e ScrollView can host only one direct child.
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.
Can any one tell me how i can set my scroll view with both vertical and horizontal scroll ?
You can't. ScrollView is vertical scroll. HorizontalScrollView is horizontal scroll.
The only View (in the SDK) that I know of that has both vertical and horizontal scroll is the WebView. See if you can work with that. If not, you'll have to create your own View.
If you need both horizontal and vertical scrolling, you shouldn't be using ScrollViews. Instead, as this question points out, you can use a combination of FrameLayouts and RelativeLayouts to achieve the desired effect.