Кто подскажет как создать картинку с текстом на чистой джаве?
И как сделать перекрытие окна на андроид
И как сделать перекрытие окна на андроид
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new DrawView(this));
}
class DrawView extends View {
Paint p;
Rect rect;
StringBuilder sb;
int count;
int x;
int y;
int r;
int offset;
public DrawView(Context context) {
super(context);
p = new Paint();
rect = new Rect();
sb = new StringBuilder();
}
@Override
protected void onDraw(Canvas canvas) {
x = canvas.getWidth() / 2;
y = canvas.getHeight() / 2;
r = 50;
offset = 300;
count = 4;
canvas.drawARGB(80, 102, 204, 255);
p.setColor(Color.BLUE);
// толщина линии = 10
p.setStrokeWidth(10);
// рисуем точку (в центре)
canvas.drawPoint(x, y, p);
// рисуем круг с радиусом = 50
canvas.drawCircle(x, y - offset, r, p);
canvas.drawCircle(x + offset, y, r, p);
canvas.drawCircle(x, y + offset, r, p);
canvas.drawCircle(x - offset, y, r, p);
// настраиваем размер текста = 30
p.setTextSize(70);
p.setTextAlign(Paint.Align.CENTER);
p.setColor(Color.BLACK);
canvas.drawText("1", x, y - offset + 30, p);
canvas.drawText("2", x + offset, y + 30, p);
canvas.drawText("3", x, y + offset + 30, p);
canvas.drawText("4", x - offset, y + 30, p);
}
}
}