Overview

ParallaxHeaderViewPager Example

HeaderView to secure the top left and right swipe at ViewPager even when a sample code for implementing HeaderView UI that can be maintained. Through the sample code, you can configure a better UI.

screens

Sample Application Download

https://play.google.com/store/apps/details?id=com.kmshack.newsstand

License

Apache License, Version 2.0

Comments
  • How can i use this with gridview.

    How can i use this with gridview.

    Inside SampleListFragment you are adding a blank header what if we want to use a GridView or scrollView rather than ListView and in adjustScroll we can setSelectionFromTop in listView or setScroll in ScrollView but what about GridView ( setSelection is not working perfectly )? How can we achieve that without setting a blank header.

    opened by 29jitender 4
  • Image is not displayed initially

    Image is not displayed initially

    Hi,

    I edited the layout a bit for my project's purpose as below:

        <com.flavienlaurent.notboringactionbar.KenBurnsView
            android:id="@+id/header_picture"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@drawable/picture0" />
    

    // I replace the imageview with a custom view

            <ImageView
                android:id="@+id/header_logo"
                android:layout_width="@dimen/header_logo_size"
                android:layout_height="@dimen/header_logo_size"
                android:layout_centerInParent="true"
                android:layout_alignParentTop="true"
                android:paddingTop="15dp"
                />
    
            <ImageView
                android:id="@+id/header_logo_hide"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_centerHorizontal="true" />
    
            <TextView
                android:id="@+id/header_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/header_logo"
                android:layout_centerHorizontal="true
                android:paddingTop="20dp"
                android:textSize="20dp"
                android:textStyle="bold" />
      </RelativeLayout>
    
    </FrameLayout>
    

    and I use this layout in a fragment, so the code was changed a bit to work in fragment

    • The view was inflated in onCreateView and onActivityCreated.
    • Instead of interpolating header_logo to the action bar icon, I want header_logo to interpolating to the header_logo_hide. The code changed: interpolate(mHeaderLogo, mHeaderLogoHide, sSmoothInterpolator.getInterpolation(ratio));

    Issue: when open the fragment, the header_logo is not displayed unless I make a initial action like scroll or touch or click.

    Please help to advise me.

    opened by francophong 1
  • When ViewPager is crolling, try to adjustScroll currentHolder

    When ViewPager is crolling, try to adjustScroll currentHolder

    when the ViewPager is crolling, try to adjustScroll currentHolder.If you don't do it, when the next or pre fragmen displayed to the user , there will be a big blank View

    opened by cundong 0
  • [ImgBot] optimizes images

    [ImgBot] optimizes images

    Beep boop. Your images are optimized!

    Your image file size has been reduced by 75% 🎉

    Details

    | File | Before | After | Percent reduction | |:--|:--|:--|:--| | /screen.png | 5,416.67kb | 873.75kb | 83.87% | | /res/drawable-xxhdpi/ic_launcher.png | 24.20kb | 17.58kb | 27.36% | | /res/drawable-xhdpi/ic_launcher.png | 12.22kb | 9.30kb | 23.95% | | /res/drawable-xhdpi/ic_header_logo.png | 198.76kb | 157.40kb | 20.81% | | /res/drawable-hdpi/ic_launcher.png | 7.48kb | 6.00kb | 19.82% | | /res/drawable-mdpi/ic_launcher.png | 3.69kb | 3.21kb | 12.95% | | /res/drawable/pic1.jpg | 325.70kb | 293.76kb | 9.81% | | /res/drawable/pic0.jpg | 223.38kb | 204.38kb | 8.51% | | | | | | | Total : | 6,212.10kb | 1,565.38kb | 74.80% |


    📝docs | :octocat: repo | 🙋issues | 🏅swag | 🏪marketplace

    opened by imgbot[bot] 0
  • Not able to run code

    Not able to run code

    15921-15921/com.kmshack.newstand E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.kmshack.newstand, PID: 15921 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.kmshack.newstand/com.kmshack.newsstand.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setAlpha(float)' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2314) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2388) at android.app.ActivityThread.access$800(ActivityThread.java:148) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5312) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setAlpha(float)' on a null object reference at com.nineoldandroids.view.ViewHelper$Honeycomb.setAlpha(ViewHelper.java:185) at com.nineoldandroids.view.ViewHelper.setAlpha(ViewHelper.java:19) at com.kmshack.newsstand.MainActivity.onCreate(MainActivity.java:78) at android.app.Activity.performCreate(Activity.java:5953) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1128) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2267)             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2388)             at android.app.ActivityThread.access$800(ActivityThread.java:148)             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)             at android.os.Handler.dispatchMessage(Handler.java:102)             at android.os.Looper.loop(Looper.java:135)             at android.app.ActivityThread.main(ActivityThread.java:5312)             at java.lang.reflect.Method.invoke(Native Method)             at java.lang.reflect.Method.invoke(Method.java:372)             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)

    opened by NaveenDan 0
  • needed help to achive this type of effect  ?

    needed help to achive this type of effect ?

    http://www.dailymotion.com/dm_5233001e62925 can someone pls tell me how can i achieve this type of video effect in android using this lib i m using tabs+viewpager for each tab there will be listview and gridview

    opened by engr-erum 0
  • Fixed Size Header.

    Fixed Size Header.

    Hello,

    In your sample app you have kept the header size fixed.

    As per my app's requirement i cannot keep it fixed. I tried by changing the Header-FrameLayout and FakeHeader-FrameLayout to WrapContent. But it does not work. The Header gets fixed and does not scroll with the ListView.

    Can you please help me??

    opened by ShagunParikh 0
Owner
Minsoo Kim
Minsoo Kim