S
S
svd71_12013-11-24 16:11:22
Android
svd71_1, 2013-11-24 16:11:22

How to programmatically clear Canvas from SurfaceView?

There is a layout with an ImageView and a SurfaceView descendant.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/rlMain"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".BlockerActivity" >
    <ImageView
        android:id="@+id/ivCenter"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:src="@drawable/ic_launcher" android:contentDescription="TODO"/>

    <com.example.lookatme.SView
        android:id="@+id/sView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/ivCenter"
        android:layout_alignTop="@+id/ivCenter" />

</RelativeLayout>

As you might guess, the ImageView contains a background image, and the SurfaceView is used for drawing. Here it is required at some point to clear the SurfaceView drawn on the canvas, but I did not think of how to achieve this.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bimeg, 2013-11-24
@svd71_1

setVisibility(View.INVISIBLE);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question