andraskindler / parallaxviewpager Goto Github PK
View Code? Open in Web Editor NEW[Development stopped in 2014. Unfinished and not stable - not recommended to use.] An easy-to-use ViewPager subclass with parallax background effect for Android apps.
[Development stopped in 2014. Unfinished and not stable - not recommended to use.] An easy-to-use ViewPager subclass with parallax background effect for Android apps.
The background is not shown at all!
Hi,
as I see, there are already a couple of questions, how to make your library work with the popular ViewPagerIndicator library.
Can you please just delete a ParallaxViewPager#addOnPageChangeListener(OnPageChangeListener listener) method, to make it possible to call the native method from ViewPager#addOnPageChangeListener(OnPageChangeListener listener)?
So it becomes possible to use not only 2 listeners.
Actually secondOnPageChangeListener field is unnecessary now, it can be removed too.
thanks in advance & best regards
Vitaly
Love the component you've made!
However, I'm encountering a couple of problems, which I haven't been able to save yet.
If I leave out the background of the XML, the app crashes because of an inflation exception. Even if it is specified in the activity. Might be nice to fix this one at a certain time.
The other thing:
The background is not drawn before there was a swipe/motion event. Have you ever experienced this? I think it happened after I made the FragmentStatePagerAdapter so that it could add Fragments dynamically.
Any of this sounds familiar? I'm still looking to see if I can find anything in the code, if so, I will let you know as well.
This would make the library compatible with other libraries that set their own PageChangeListener. This is required to make this work with the popular ViewPagerIndicator library.
app:viewpager_hideToolbarAndTitle="false"
Then scroll down just a little bit (halfway)
Then swipe left/right
Suddenly the actionbar has background color and tabstrip also.
Also sometimes when sticky the whole header gets pulled up beyond the status bar, sometimes opposite it gets pulled to almost middle of the screen.
More an report for the author to look for bugs. Tested on Samsung S6 Edge, Android 5.1
Hi. It seems that every time the soft keyboard pops up, the method onSizeChanged is called and the background resource drawn again, which means that the image will sqeeze vertically. It would be nice if the pager included a "allowBackgroundResize(boolean allow)" method, so we could disable it if, for example, the keyboard pops up.
hello,Here's my code:
mViewpager.setAdapter(mAdapter);
mViewpager.setOverlapPercentage(0.99f);
mViewpager.setBackgroundResource(R.drawable.btn_page_bg);
mIndicator.setViewPager(mViewpager);
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
Maybe some states need to be saved? As a habit, I check "Don't keep activities" at system settings when debugging. After I switch to other app and switch back, which means the activity is destroyed, The background image disappears.
I carefully check the background, and find that the image is still there actually, but it's placed at the right side of screen; I can only see the image at the right edge of screen at first page of viewPager.
Any idea to fix it?
this is my code:
<com.andraskindler.parallaxviewpager.ParallaxViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:background="@drawable/background"
android:layout_weight="1"
android:visibility="gone"/>
and the page width: return(0.8f);
the problem is when u go to the next page 0.2 background of the page is white
Please put a small sample for the library.
@Override
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_home, container, false);
parallaxHorizontalViewPager = ((ParallaxViewPager) view.findViewById(R.id.parallaxviewpager));
parallaxHorizontalViewPager.setAdapter(new PageHorizontalHomeAdapter(getFragmentManager()));
parallaxHorizontalViewPager.setScaleType(ParallaxViewPager.FIT_WIDTH);
parallaxHorizontalViewPager.setBackgroundResource(R.drawable.image);
return view;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
parallaxHorizontalViewPager.setCurrentItem(1, false);
}
setCurrentItem makes black background. It's like it can calculate the width or something
While using ParallaxViewPager
with CirclePageIndicator
of https://github.com/JakeWharton/Android-ViewPagerIndicator, the parallax background is not shown. So what needs to be done to use ParallaxViewPager
with CirclePageIndictor
. And lastly, great library. Thanks
Can we customize the parallax to a video background? like a 5 sec video on a continuous loop.
If the ViewPager is on the first page, screen rotation works just fine. But if on any of the other pages and I rotate my phone, the background image disappears, resulting, in my case, in a white background.
I have tried in vain to reset the background resource on onConfigurationChange().
I am using a resource with the dimensions 1500x1000 as background, set with setBackgroundResource()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.