There is a code that colors the image in blue squares. It all happens immediately when you open the application. How to make these squares gradually painted over with some kind of delay? That is, you probably need to put the cycle in the stream
MainActivity
public class MainActivity extends Activity { private View drawView, drawViewRect; int i, j; String Tag = "oh!"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); drawView = new DrawView(this); setContentView(drawView); for (i = 1; i <= 36; i++) { for (j = 48; j >= 1; j--) { drawViewRect = new DrawViewRect(this); setContentView(drawViewRect); } } } } Drawview
public class DrawView extends View { Paint p; Rect rect; Bitmap bitmap; String Tag = "Oh!"; private int startX = 0; private int startY = 0; private int endX = 0; private int endY = 0; private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG) { { setDither(true); setColor(Color.RED); setStrokeWidth(20); } }; public DrawView(Context context) { super(context); p = new Paint(); //шаблон квадрата rect = new Rect(0,940,20,960); } public DrawView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); //фоновая заливка canvas.drawARGB(80, 102, 204, 255); //фоновая картинка bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.pic); p.setColor(Color.RED); canvas.drawBitmap(bitmap, 0, 0, p); } } DrawViewRect
public class DrawViewRect extends View { Paint p; Rect rect; Bitmap bitmap; String Tag = "Oh!"; //конструктор public DrawViewRect(Context context) { super(context); p = new Paint(); //шаблон квадрата rect = new Rect(0,940,20,960); } public DrawViewRect(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onDraw(Canvas canvas) { p.setStyle(Paint.Style.FILL); p.setARGB(255, 0, 0, 255); canvas.drawRect(rect, p); canvas.translate(0, -20); } }