Search code examples
androidxamarin.androidandroid-webviewslidingdrawer

SlidingDrawer content covered by WebView


I have a WebView and a SlidingDrawer that when openend opens up over the WebView or at least that is the idea. The sliding drawer handle and content shows up above and below the WebView but not on top of the WebView meaning that the WebView's content is visible instead of the SlidingDrawer's content.

<RelativeLayout xmlns:d1p1="http://schemas.android.com/apk/res/android"
    d1p1:minWidth="25px"
    d1p1:minHeight="25px"
    d1p1:layout_width="fill_parent"
    d1p1:layout_height="fill_parent"
    d1p1:id="@+id/relativeLayout2"
    d1p1:paddingTop="10dp"
    d1p1:paddingRight="10dp"
    d1p1:paddingLeft="10dp">
    <RelativeLayout
        d1p1:minWidth="25px"
        d1p1:minHeight="25px"
        d1p1:id="@+id/relativeLayout1"
        d1p1:layout_width="wrap_content"
        d1p1:layout_height="wrap_content"
        d1p1:layout_alignParentTop="true">
        <LinearLayout
            d1p1:orientation="vertical"
            d1p1:minWidth="25px"
            d1p1:minHeight="25px"
            d1p1:layout_width="wrap_content"
            d1p1:layout_height="wrap_content"
            d1p1:id="@+id/linearLayout1"
            d1p1:layout_alignParentRight="true">
            <TextView
                d1p1:text="Time Remaining"
                d1p1:textAppearance="?android:attr/textAppearanceSmall"
                d1p1:id="@+id/studentQuestionZoneQuestionContent_textView_timeRemainingLabel"
                d1p1:typeface="normal"
                d1p1:textSize="22sp"
                d1p1:textColor="#ff000000"
                d1p1:layout_width="fill_parent"
                d1p1:layout_height="wrap_content" />
            <LinearLayout
                d1p1:orientation="horizontal"
                d1p1:minWidth="25px"
                d1p1:minHeight="25px"
                d1p1:layout_width="fill_parent"
                d1p1:layout_height="wrap_content"
                d1p1:id="@+id/linearLayout2"
                d1p1:gravity="center_horizontal">
                <TextView
                    d1p1:text="XXX"
                    d1p1:textAppearance="?android:attr/textAppearanceSmall"
                    d1p1:id="@+id/studentQuestionZoneQuestionContent_textView_timeValue"
                    d1p1:typeface="normal"
                    d1p1:textSize="25sp"
                    d1p1:textColor="#ff000000"
                    d1p1:layout_width="wrap_content"
                    d1p1:layout_height="fill_parent"
                    d1p1:gravity="bottom" />
                <TextView
                    d1p1:text="Seconds"
                    d1p1:textAppearance="?android:attr/textAppearanceSmall"
                    d1p1:id="@+id/studentQuestionZoneQuestionContent_textView_timeValueUnits"
                    d1p1:layout_width="wrap_content"
                    d1p1:layout_height="fill_parent"
                    d1p1:typeface="normal"
                    d1p1:textSize="19sp"
                    d1p1:textColor="#ff000000"
                    d1p1:gravity="bottom"
                    d1p1:paddingLeft="10dp" />
            </LinearLayout>
        </LinearLayout>
        <TextView
            d1p1:text="Question Description"
            d1p1:textAppearance="?android:attr/textAppearanceLarge"
            d1p1:layout_width="wrap_content"
            d1p1:layout_height="wrap_content"
            d1p1:id="@+id/studentQuestionZoneQuestionContent_textView_questionDescription"
            d1p1:layout_centerInParent="true"
            d1p1:typeface="normal"
            d1p1:textSize="25sp"
            d1p1:textColor="#ff000000" />
    </RelativeLayout>
    <SlidingDrawer
        d1p1:content="@+id/content"
        d1p1:handle="@+id/handle"
        d1p1:minWidth="25px"
        d1p1:minHeight="25px"
        d1p1:layout_width="fill_parent"
        d1p1:layout_height="fill_parent"
        d1p1:id="@+id/slidingDrawer1"
        d1p1:layout_alignParentBottom="true"
        d1p1:layout_centerHorizontal="true"
        d1p1:background="#00000000">
        <Button
            d1p1:id="@+id/handle"
            d1p1:layout_width="wrap_content"
            d1p1:layout_height="wrap_content"
            d1p1:text="Scratchpad"
            d1p1:background="@drawable/button_question_zone_scratch_pad_without_annotation" />
        <LinearLayout
            d1p1:id="@+id/content"
            d1p1:layout_width="match_parent"
            d1p1:layout_height="match_parent"
            d1p1:minWidth="25px"
            d1p1:minHeight="25px">
            <SurfaceView
                d1p1:layout_width="fill_parent"
                d1p1:layout_height="fill_parent"
                d1p1:id="@+id/surfaceView1"
                d1p1:background="#ffffffff" />
        </LinearLayout>
    </SlidingDrawer>
    <Button
        d1p1:text="Scratchpad"
        d1p1:id="@+id/studentQuestionZoneQuestionContent_button_scratchpad"
        d1p1:background="@drawable/button_question_zone_scratch_pad_without_annotation"
        d1p1:typeface="normal"
        d1p1:textSize="22sp"
        d1p1:textStyle="bold"
        d1p1:textColor="#ff666666"
        d1p1:layout_width="wrap_content"
        d1p1:layout_height="wrap_content"
        d1p1:layout_alignParentBottom="true"
        d1p1:layout_centerHorizontal="true"
        d1p1:paddingLeft="50dp"
        d1p1:paddingRight="10dp"
        d1p1:visibility="invisible" />
    <WebView
        d1p1:id="@+id/studentQuestionZoneQuestionContent_webView_content"
        d1p1:layout_below="@id/relativeLayout1"
        d1p1:layout_above="@id/studentQuestionZoneQuestionContent_button_scratchpad"
        d1p1:layout_width="fill_parent"
        d1p1:layout_height="fill_parent" />
    <ProgressBar
        style="@android:style/Widget.Holo.ProgressBar.Large"
        d1p1:layout_width="wrap_content"
        d1p1:layout_height="wrap_content"
        d1p1:id="@+id/studentQuestionZoneQuestionContent_progress_loadingContent"
        d1p1:layout_below="@id/relativeLayout1"
        d1p1:layout_above="@id/studentQuestionZoneQuestionContent_button_scratchpad"
        d1p1:layout_centerHorizontal="true" />
</RelativeLayout>

Solution

  • Rearrange your layout file so that the SlidingDrawer code appears below the WebView code. The z-index of your widgets is determined by its position in the file. A widget further down the file has a higher z-index.

    You could also use View.bringToFront().