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

layout height problem with ViewPager #44

Closed
Andecy opened this issue Nov 25, 2016 · 3 comments
Closed

layout height problem with ViewPager #44

Andecy opened this issue Nov 25, 2016 · 3 comments

Comments

@Andecy
Copy link

Andecy commented Nov 25, 2016

I use ScrollableLayout in a TabLayout+ViewPager,and ScrollableLayout has a LinearLayout(with Tablayout+ViewPager), if the ScrollableLayout in first page of tab,the height is ok,or else can see ScrollableLayout

@noties
Copy link
Owner

noties commented Nov 25, 2016

Can you show me your XML layout, please?

@Andecy
Copy link
Author

Andecy commented Nov 25, 2016

the parent XML:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:tl="http://schemas.android.com/apk/res-auto"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@color/default_background"
              android:orientation="vertical">

    <com.flyco.tablayout.SlidingTabLayout
        android:id="@+id/stl_sliding"
        style="@style/TabLayout.Section"
        android:layout_height="48dp"
        tl:tl_indicator_color="@color/primary"
        tl:tl_tab_padding="@dimen/padding_tv_ic_drawable"
        tl:tl_tab_space_equal="true"
        tl:tl_textSelectColor="@color/primary"
        tl:tl_textUnselectColor="@color/secondary_text"
        tl:tl_underline_color="@color/default_background"
        tl:tl_underline_gravity="BOTTOM"
        tl:tl_underline_height="1px"/>

    <android.support.v4.view.ViewPager
        android:id="@+id/vp_sliding"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"/>
</LinearLayout>

and it's first child:

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

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

        <FrameLayout
            android:id="@+id/fl_analysis_task_chart"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/primary_dark"/>

        <com.flyco.tablayout.SlidingTabLayout
            android:id="@+id/stl_topic"
            style="@style/TabLayout.Topic"
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:paddingLeft="5dp"
            android:paddingRight="5dp"
            app:tl_indicator_color="#393E46"
            app:tl_indicator_corner_radius="5dp"
            app:tl_indicator_margin_left="2dp"
            app:tl_indicator_margin_right="2dp"
            app:tl_indicator_style="BLOCK"/>

    </LinearLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/vp_topic"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="48dp"/>

</ru.noties.scrollable.ScrollableLayout>

@noties
Copy link
Owner

noties commented Nov 25, 2016

I think that you, if it's applicable, should change your layouts to be flat, because having ViewPager inside another ViewPager is a error-prone thing anyway. Why won't you make ScrollableLayout the root layout and then apply your tabs/pages logic there?

@noties noties closed this as completed Feb 22, 2017
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