4

I want to have a transparent view behind the LinearLayout which can consume click events, but only those events that were not consumed by LinearLayout children, so I use the following layout xml for this:

<?xml version="1.0" encoding="utf-8"?>
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true">

        <FrameLayout
            android:id="@+id/content"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <View
                android:id="@+id/test_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">
                    ....
            </LinearLayout>
        </FrameLayout>
    </ScrollView>

The problem (when content is long enough to not fit in a screen):

on android 2.3 view (id="test_view") has a zero height but on android 4.2 it has height as big as its parent FrameLayout.

Tried to add dynamically this view through addView in code but not working, replaced FrameLayout with RelativeLayout - the same problem.

It works only with concrete height value (for example, 20dp), but I want this view to be as big as its parent. Please, help to resolve this problem.

4

0 回答 0