horizontal pager with vertical pager. How can we apply? - java

If any one has answer for this question please comment me.
Vertical-Pager
Horizontal-Pager
So please check this two projects. I just want to implement both in only one class so I can scroll both side with only one class.

I know for a fact that the Horizontal Pager class supports Vertical scrolling, so I believe you can nest them. Add code to the Horizontal Paging class that can detect Vertical Paging.
Or,
you could add a ScrollView to every child from the ViewGroup inside the Horizontal Pager.

Related

How to programatically find which view is being scrolled to the top in the screen?

I have four recyclerviews inside a NestedScrollview and i am setting tag for each recyclerview elements in order to design sticky header.
I have to get the view at the top most position so that i can get the tag of that view and implement sticky.
After i am searching through forums, still i didn't able to get the correct code on getting the view at the top position of a screen.
Any help on this will be really helpful for my project
Set and implement OnScrollListener on your Activity class. Then you should override onScroll, onScrollStateChanged which will provide you the view is scrolled and its state. Look at it - https://developer.android.com/reference/android/widget/AbsListView.OnScrollListener.html

A view or Layout like GridView

I am trying to create a custom view like a GridView but with the difference of scroll bar functionality. i.e. I want that the GridView should create the column and rows dynamically and must hold a TextView or EditText view inside each cell of the grid and the custom view can be scrolled in vertically and horizontally too.
I have been tried with Table and default Grid Layout but I failed. Any idea, suggestion or comments are welcome.
Thank you.
You should use RecyclerView for this purpose. You will have to declare the number of Columns upfront. You cannot have different number of columns at runtime.
However Horizontal and Vertical Scrolling at the same time is tricky but still can be done.
Checkout: http://belladunovska.com/tech/nested-recycler-view-in-android
There is a talk on the same topic by Android Lead of NewCircle Training
Also you can checkout TwoWayView: https://github.com/lucasr/twoway-view (I think it is not using RecyclerView)

Android ScrollView, check if currently scrolling

Is there a way to check if a standard ScrollView is currently being scrolled?
Doesn't matter if the direction is upwards or downwards, i only need to check whether it's currently being scrolled at all.
ScrollView in its current form does not provide a callback for detecting scroll events. There are two workarounds available:
1. Use a ListView and implement OnScrollListener.
2. Derive a custom class from the existing ScrollView implementation and extend it to provide callbacks for scroll events.

Android Horizontal Scrolling that Snaps to List Items

I'd like to implement a UI experience in Android where a user can view a single item (for example, an item in my case is a collection of texts), and swipe left or right on the item to go to the previous or next item.
From my research, ListView does not implement horizontal scrolling. Potential candidates seem to be HorizontalScrollView and GridView, but I haven't seen any examples that can do this simply - only seemingly complicated libraries that need to be included.
My question is, is there a way to use ListView, HorizontalScrollView, GridView, or a combination of them to implement a horizontal scroll that shows one item at a time and snaps to the item being displayed?
The highlighted area in the picture below shows where I'm trying to implement this logic.
It looks like the best option to achieve this experience is a ViewPager, which requires the android support library.
http://developer.android.com/reference/android/support/v4/view/ViewPager.html

How to remove a view from a LinearLayout without affecting the positions of the other children?

I am trying to add/remove views to a LinearLayout inside a ScrollView. I would like to remove/add views to the LinearLayout while it is scrolling for larger lists might blow memory and/or be slow. Is there any way to remove a View from the LinearLayout without it affecting the position of its siblings?
When I call linearLayout.removeChildAt(0), all of the views snap back one, making it really difficult to maintain a constant scrolling effect.
I am not sure if this is applicable for you(maybe u are aware of this already), but usually when there is a list of view which you have to show, instead of using scrollviews and adding/removing subviews yourself, you can make use of ListView in android.
When you remove a view, replace it with a blank placeholder view of the same size as the removed view.
By adding/subtracting the size of the removed View at position 0 to the parents padding, I effectively stopped the "chopping" effect when I was removing views.

Categories

Resources