Scrollable tab scrolls under title bar
mcutchember opened this issue · comments
Hello,
I am trying to figure out how I can keep my scrollable tab under my title bar. I added a view and to give you a little context, I am creating a profile page. As of now, it scrolls perfectly but it goes all the way to the top beneath the title bar. I would like it to scroll only to the title bar.
I am using a viewPager for the tabs.
I have provided images.
images:
https://imgur.com/4fn0nK6
https://imgur.com/aTQFbr1 (this what i want)
https://imgur.com/BWoMzKW (but this happens)
https://imgur.com/bFYJsdN
https://imgur.com/tRBX2zl
THis may be a dumb question but thank you anyway.
Hello @mcutchember !
There are no dumb questions. I think there is a problem with your layout. If you change it to be like this:
<?xml version="1.0" encoding="utf-8"?>
<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"
app:scrollable_autoMaxScroll="true">
<View
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="300dip"/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="56dip"/>
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="56dip"/>
</ru.noties.scrollable.ScrollableLayout>
The issue should be resolved. Please note what I had done:
- removed
RelativeLayout
as the first (and only child) ofScrollableLayout
. It haslayout_height=match_parent
, soScrollableLayout
would consider it to be the sole header. - specified exact dimension as
layout_height
for theTabLayout
and used this value for theViewPager
layout_marginTop
attribute. - specified
layout_height=match_parent
for the ViewPager as it is the important part for the ScrollableLayout to function
Hope this helps!