Viewpager horizontal scrollbar not showing up - Android- - android

In my viewpager Ive enabled horizontal scrollbar by such featuredPager.setHorizontalScrollBarEnabled(true);
However it never shows up or does anything

setHorizontalScrollBarEnabled is a method of View. It will not work as an indicator for the pages of a ViewPager. You can make your own View that does this, by listening using an implementation of ViewPager.OnPageChangeListener. However, there are already some libraries that can handle this for you, like this one. I would recommend you to try that first.

Related

RecyclerView with Horizontal GridLayoutManager and PageIndicator

I am relatively new to android and stuck on this particular implementation.
How do i implement a View(RecyclerView) with Horizontal GridLayoutManager(3*5) along with PageIndicator so basically 1st page would show 15 images, swiping left would show another 15(PageIndicator would change color) and so on.
Thanks in advance!!
you used viewpagerand set recycler view in viewpager or gridview. viewpager to handle swipe and easy. and you give it pageindictor in viewpager it's implement is easy.
you use recycler view in you give left is hard and you do use pagination so it's implemention is hard
It's frustrating when you are been downvoted, and i understand that, hence i tried to implement this myself and the implementation details can be found here
Adjust Items inside recycler view + orientation changes.

Swiping a SlidingPaneLayout inside a ViewPager

I'm trying to use a SlidingPaneLayout inside of a ViewPager. All I can find are solutions for the other way around, like Using Android's SlidingPaneLayout with ViewPager which doesn't work.
Is there something easy to change to allow the SlidingPaneLayout's edge to get priority over a ViewPager's? I don't know anything about handling touch events or I'd try to tackle it myself.
JFeinstein slideMenu project is referred to in this post - very similar to yours. The config for the inner view can be configured to consume the swipe from the edge of the bezel, before that event propogates to the ViewPager

Horizontal Carousel or ScrollView with text over image

I'm trying to figure out the best approach to design a horizontal scrollview from android >= 2.1 with some text over the image that when scroll if end is reached it starts showing the first items again hence carousel behavior.
You can continue scrolling horizontally, forever, and the first item shows up again when the end is reached, for example when scrolling swiping to the left. It can be a view pager with an adapter, a carousel but not horizontal scrollview as it does not support some android device.
Any suggestions would be greatly appreciated.
Why not use a ViewPager? As it is available in the Support Library. I would insist to use ViewPager instead of HorizontalScrollView or Gallery. You can check an example for ViewPager from my github.
UPDATE
To show multiple views inside a Fragment you can use getPageWidth(). Check here for reference.
For future people looking for this, here's an excellent library that fit my needs for a similar problem!
https://github.com/sparrow007/CarouselRecyclerview

Vertical swipe in ViewPager

I use ViewPager with PagerAdapter. Is it possible to implement vertical swipe in Android, where you can scroll between views from top to down and from down to top? I need identical behavior that ViewPager does by default, but in vertical way. I found method canScrollVertically() but it's not what I am looking for I suppose. Thanks in advance
Natively, no.
However, Jake Wharton has a directional ViewPager that does this.
https://github.com/JakeWharton/Android-DirectionalViewPager/
The only problem is he doesn't support it anymore, but it will get you started. It might even be enough for what you want.

How do I add a ViewPager as the top item in my ListView

I have a vanilla "News" app, where the main page is a ListView that scrolls vertically with a list of articles (thumbnail, title..etc). This works just fine, but now I want to add a horizontal article/photo rotator as the top item in that list. I don't really care if it's technically in the list or not, but it should scroll up/off the screen when the list is dragged...etc. I assume(d) it should be in the list, but am quite new to Android and don't know if there's a better solution.
After an entire day of searching around, I'm still empty-handed - don't know how to add it or even if it's the right method. I'm using a ViewPager for my gallery view (when they click a photo), and that seems to be working fine...but that's the entire view... and this one already has an adapter that populates the listView... I hope I'm just over-complicating something.
TLDR:
1) Can I add a ViewPager as top item in a ListView?
2) How would one go about doing it?
3) Is there a better solution?
Note: android:minSdkVersion="8" android:targetSdkVersion="15"
You can use addHeaderView() from the ListView API to set a header. It can be any View, so also a ViewPager. I think you'll have to add it programmatically. Set the height of it correctly though.
i'm not sure i understand your question. ViewPager is a view like any other, so in your ListView's adapter's getView() method, return a view that contains a ViewPager.
ViewPager is a topic in itself, so if your problem is that you don't understand ViewPager, read these links,
http://developer.android.com/reference/android/support/v4/view/ViewPager.html
http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html
if you are using API level 8, you should use the ViewPager and friends from the compatibility package.
that all being said, i wonder if you will have trouble putting a scrollable view inside a scrollable view. i know ViewPager contains code to pass off any gestures to child views if it decides it cannot handle them. i can't say if ListView has the same smarts.

Categories

Resources