Please note this is not about nested scrolling.
Recently i switched to ViewPager2. I have setup viewpager2 with a tabview (viewpager2 is horizontal). So on one of the fragment has a recyclerview. So when I scroll down on the recyclerview, some times the viepager2 switches tabs. This was not happening on the old viewpager. So if I need to scroll the recyclerview without changing the viewpager2 tabs, I need to carefully touch and drag 100% vertically like a straight line. if the touch is not a straight line, the viewpager2 switches tabs. If anyone can point me towards a fix, I would be glad. Thanks
I did try the NestedScrollableHost wrapper and it did not help.
Related
I have a recyclerview, in this recyclerview I have a lot of cardviews with information. I need to make that when the user makes a long press in one of the cards in the recyclerviews. The menu should look like this, with the rounded corners and the icons.
WHAT I HAVE TRIED
I have tried Making a context menu, this didn't worked because the icons and the rounded corners didn't appeared. I have also tried with a popup menu, this didn't work either. The current thing I have, is that I made a layout based on a Recyclerview, changing its position and visibility when a long touch ocurres; this didn't worked as expected, so that's why I am here. I'm trying to make this inside my ViewHolder of my CardAdapter, so I can use the OnLongPressed event.
In my application I have an activity thats layout is basicly following:
App layout
The red part is a viewpager with fragments.
The blue part is a layout with buttons that doesnt change with swipe on viewpager.
But i want that the viewpager is swipable (smoothly) in the hole green framed area. It should act like normal viewpager behavior.
I have absolutely no idea if that is even possible or not, but hope it does.
I thought that it is maybe possible with a gestureoverlay or something, but don't know how to apply the detected gesture on the viewpager.
Only detecting swipe and set current page is not what I want achieve.
(I'm writing in java)
If the height of the viewpager and buttons layout are somewhat fixed, here is a solution:
1, use a ConstraintLayout as the root container
2, make viewpager the same size as the root, set the viewpager's padding to some value say 8dp
3, place the buttons layout over the view pager, taking up the bottom half space(except for some margin), the viewpager should still respond to touch where there is no button
4, for fragments inside view pager, use a ConstraintLayout to put the content at the top half of the page
I think this is what you are looking for
Nested Action Bar Tabs(with ViewPager)
There's also a demo on Github: https://github.com/r3dm4n/NestedActionBarTabswithViewPagerDEMO
Let me know if it helped
I have a TabLayout with a ViewPager connected. I want to forbid user to drag it slowly, I mean I want ViewPager change its pages on swipe gesture with the same instant behaviour as clicking on Tabs do.
I tried to remove swipe in ViewPager, but since it's content can be really big I can't leave it as it is.
maybe you can help me. I want to use viewPager to overlap an other layout. so for example: I the first Fragment. On this Fragment is a picture, than I swipe to the right and then the second Fragment should just go over the first Fragment. It's like in the Android Youtube App in which you swipe from left to right and the settings and etc go over the main layout(like in the picture). Can you tell me what i have to do?
Thanks a lot, Vinzenz.
picture:
http://i.stack.imgur.com/CQ8gL.png
What you're asking for is actually not related to ViewPager. There is another layout you can use to implement the same navigation pane overlay: DrawerLayout link: http://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html
I've been searching for this topic for a while, and can't find enough resources or tuts about scrolling a PagerTabStrip. I'm using the FragmentStatePagerAdapter and populates the PagerTabStrip with getPageTitle(int position). I'd like to know how to make the titles scrollable. I'd like to scroll the titles without affecting the view by the time I stop or select into a specific title, then that's the time the view gets updated. I've been thinking to use HorizontialListView but not sure how to start. Hoping to learn from you. Thanks.
Found this on docu:
PagerTabStrip is an interactive indicator of the current, next, and
previous pages of a ViewPager. It is intended to be used as a child
view of a ViewPager widget in your XML layout. Add it as a child of a
ViewPager in your layout file and set its android:layout_gravity to
TOP or BOTTOM to pin it to the top or bottom of the ViewPager. The
title from each page is supplied by the method getPageTitle(int) in
the adapter supplied to the ViewPager.
I been searching on this on the web, but I didn't get any relevant resources. I just found out another library called actionsherlock that enables the scrolling of tabs without affecting the view which is exactly what I need, instead of using PagerTabStrip's listener .
I'm also searching for the same thing. Too bad you have to make your own implementation or use third-party library. I have read that this library offer the feature of scrolling tab independent of the content. But I have not tried it out yet.
http://viewpagerindicator.com/?utm_source=androidweekly&utm_medium=toolbox
Do you actually mean the ActionBarSherlock? Do you have an example?