Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't use viewpager in the header part instead of textview? #17

Closed
jboeyin opened this issue Aug 19, 2015 · 4 comments
Closed

can't use viewpager in the header part instead of textview? #17

jboeyin opened this issue Aug 19, 2015 · 4 comments

Comments

@jboeyin
Copy link

jboeyin commented Aug 19, 2015

Hi, it is a awesome project, I just met a problem, I wanna replace the textview control of the header with a viewpager, but it seems being failed, and the listview move to the header, how to fix it?

@noties
Copy link
Owner

noties commented Aug 19, 2015

Hi, I used ViewPager as a header in one of my projects, and it worked just fine. Maybe you could provide me with more details?

@jboeyin
Copy link
Author

jboeyin commented Aug 20, 2015

I using the LinearLayout replace the textview in the header, then I add a viewpager into the LinearLayout, and the whole layout is within a fragment, however it is not working. can you show me your codes?

<ru.noties.scrollable.ScrollableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollable_layout"
app:scrollable_maxScroll="@dimen/header_height"
app:scrollable_considerIdleMillis="125"
app:scrollable_friction="0.075"
app:scrollable_closeUpAnimationMillis="250"
app:scrollable_defaultCloseUp="true"
app:scrollable_scrollerFlywheel="false"
app:scrollable_closeUpAnimatorInterpolator="@android:anim/accelerate_decelerate_interpolator">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/header_height"
        android:background="@color/header_background"
        android:id="@+id/header"
        android:gravity="center">

       <android.support.v4.view.ViewPager
            android:layout_width="match_parent"
           android:layout_height="match_parent"
           android:id="@+id/banner_pager" />

    </LinearLayout>

    <ru.noties.scrollable.sample.TabsLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/tabs_height"
        android:background="@color/tabs_background"
        android:id="@+id/tabs" />

</LinearLayout>

<android.support.v4.view.ViewPager
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="@dimen/tabs_height"
    android:id="@+id/view_pager" />

</ru.noties.scrollable.ScrollableLayout>

@noties
Copy link
Owner

noties commented Aug 20, 2015

The code looks just fine (although I would eliminate ViewPager's LinearLayout in header). Maybe you could be more specific about the listview move to the header I don't quite get it.

@noties
Copy link
Owner

noties commented Aug 21, 2015

I've added a ScrollableFragment to the sample application to show how ScrollableLayout could be used inside a Fragment with a ViewPager as a header

@noties noties closed this as completed Aug 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants