noties / Scrollable

Android scrollable tabs
Apache License 2.0
1.24k stars 229 forks source link

match_parent is not respected from second child #3

Closed buraktamturk closed 9 years ago

buraktamturk commented 9 years ago

Hello,

I have a screen like this. I want to hide the header (including Tabs and "Kitapçık A B", excluding ActionBar) while scrolling to bottom.

screen shot 2015-04-04 at 11 34 59

I have implemented it like this.

<?xml version="1.0" encoding="utf-8"?>
<org.buraktamturk.loadingview.LoadingView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tf:lv_loading="false"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tf="http://schemas.android.com/apk/res-auto">
    <ru.noties.scrollable.ScrollableLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/scrollable_layout"
        tf:scrollable_maxScroll="96dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:orientation="vertical"
            android:layout_height="96dp">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:id="@+id/kitapcikLayout"
            android:background="?attr/colorPrimary"
            android:paddingLeft="11dp"
            android:paddingTop="5dp"

            android:orientation="horizontal">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:textSize="16sp"
                android:textColor="@android:color/white"
                android:text="@string/kitapcik" />

            <com.fem.tekno.utils.KitapciklarView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="15dp"
                android:layout_gravity="center_vertical"
                android:id="@+id/kitapciklar"
                />

            </LinearLayout>
        <com.astuetz.PagerSlidingTabStrip
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:textColorPrimary="@android:color/white"
            android:layout_height="56dp"
            android:background="?attr/colorPrimary" />
        </LinearLayout>

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

    </ru.noties.scrollable.ScrollableLayout>
</org.buraktamturk.loadingview.LoadingView>

The final look when it scrolled down is this.

screen shot 2015-04-04 at 11 35 05

As presented above. There is 96dp (header's height) space between bottom of the device and end of the ViewPager.

Could you help me with removing the space?

Thanks, Burak

noties commented 9 years ago

Well, as I see it, you just need to remove android:layout_marginTop="96dp" attribute from ViewPager

buraktamturk commented 9 years ago

My bad, i actually shouldn't have given marginTop to the ViewPager since it excepts non-hidden view's height and i don't have visible view.

Edit: you're a bit faster than me :), thank you so much for a such library.