Search code examples
androidandroid-layoutscrollviewclippingglsurfaceview

glsurfaceview inside a scrollview, moving but not clipping


I have a scrollview with a linear layout inside. One of the elements inside this linearlayout is a glsurfaceview.

This all works correctly and when I scroll the glsurfaceview moves up and down however when the glsurfaceview reaches the top or bottom of where it should of the scrollview where it should be clipped it is not and is continued outside of the scrollview. This screenshot should make it clearer:

glsurfaceview not clipped correctly

Don't think it's completly nessecary but here is my layout.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:orientation="vertical"
android:padding="6dip"
>
<ScrollView
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
>
    <LinearLayout
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"
    >
        <LinearLayout
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:orientation="horizontal"
        >
            <LinearLayout
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content" 
            android:orientation="vertical"
            android:layout_weight="1"
            >
            <!-- LOTS OF SEEKBARS/TEXTVIEWS -->
            </LinearLayout>
            <LinearLayout
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content" 
                android:layout_weight="1.4"
                android:layout_marginRight="10dip"
                android:layout_marginLeft="10dip"
                android:orientation="horizontal" >
                <android.opengl.GLSurfaceView android:id="@+id/glview"  
                android:layout_width="100px"
                android:layout_height="250px"/>
            </LinearLayout>
        </LinearLayout>

        <LinearLayout
        android:layout_marginTop="6dip"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_weight="1"
        android:orientation="horizontal" >
            <!-- OK/CANCEL BUTTONS -->
        </LinearLayout>
    </LinearLayout>
</ScrollView>
</LinearLayout>

All help much appreciated :)


Solution

  • Hosting SurfaceViews inside ScrollView (or Listview, etc.) is currently not supported.