Answer the question
In order to leave comments, you need to log in
Where does the Custom View disappear after turning off/on the screen?
Made a simple DressView class that extends View. In the onDraw method, I drew two rectangles and cut one from the other:
paint.setColor(Color.RED);
paint.setAntiAlias(true);
paint.setStyle(Paint.Style.FILL_AND_STROKE);
path.moveTo(0, 0);
path.lineTo(metrics.widthPixels, 0);
path.lineTo(metrics.widthPixels, metrics.heightPixels);
path.lineTo(0, metrics.heightPixels);
path.close();
path.moveTo(100, 100);
path.lineTo(metrics.widthPixels - 100, 100);
path.lineTo(metrics.widthPixels - 100, metrics.heightPixels - 200);
path.lineTo(100, metrics.heightPixels - 200);
path.close();
path.setFillType(Path.FillType.EVEN_ODD);
canvas.drawPath(path, paint);
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="@color/white"
android:layout_height="match_parent">
<ImageView android:layout_width="match_parent"
android:src="@drawable/foto"
android:id="@+id/foto"
android:layout_height="match_parent"/>
<ImageView android:layout_width="0dp"
android:id="@+id/loading"
android:src="@color/loading"
android:layout_height="match_parent"/>
<ru.memores.dressdrawer.DressView
android:layout_height="match_parent"
android:id="@+id/dress_view"
android:layout_width="match_parent"/>
</RelativeLayout>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question