What i would like to do is draw a rectangle and put some dynamic text inside,this is possible?
I guess isnt,but there are any way to resolve this??
Anyway im drawing the rectangle using this example here..
rectangle -example
What i would like to do is draw a rectangle and put some dynamic text inside,this is possible?
I guess isnt,but there are any way to resolve this??
Anyway im drawing the rectangle using this example here..
rectangle -example
The example you are giving is rather static. You could also go for a more dynamic approach where you override the onDraw method of a View:
public class MyView extends View {
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Paint p = new Paint();
p.setColor(Color.BLACK);
canvas.drawRect(10, 10, 10, 10, p);
p.setColor(Color.WHITE);
canvas.drawText("Ohai!", 0, 5, 20, 20, p);
}
}
You just then put this View on your panel where you want it. There are of course even more methods to use for this, just have a look at the Canvas class
Or you could of course just some kind of TextView you can customize (add some borders etc).