-1

I am trying to use scroll from ScrollView to expand, collapse a header I have. I cannot use the new support library because that project does not compile with latest SDK and I am doing it manually. If I use it with a WebView or another Layout it works but with a FrameLayout it does not. I am using that Frame to load Cordova content and I tried lot of solutions like add minHeight, set viewport, add the Frame into another layout.

The basic xml code is that:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:id="@+id/containerIselling"
    android:layout_height="match_parent">

    <ScrollViewExt
        android:id="@+id/scroll"
        android:scrollbars="none"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

            <FrameLayout
                android:id="@+id/frameCordova"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginTop="220dp"/>
    </ScrollViewExt>
    <RelativeLayout
         android:id="@+id/header"
         android:layout_width="match_parent"
         android:layout_height="220dp">
             //Here header content
    </RelativeLayout>
</RelativeLayout>

To collapse/expand the header I get the scrolling values and I use them to make the header bigger or smaller.

With the layout I have, the frame is not matching parent and is not using the scroll from ScrollView, it is using the scroll of Cordova's WebView and I can get the ScrollView events touching outside the Frame but there is not content to scroll and it is not working as expected.

1 Answers1

0

Little tip: Inside a ScrollView, you can't define a children with "match_parent" because always take the size of ScrollView! but you can add any layout with prefixed size (for example layout_height:"1000dp"), or add dynamically by code like a ListView

Rubber
  • 66
  • 6