Reputation: 3447
I have got a simple idea.
I would like to use a picker like that and insert Strings into it. Has anyone an idea how to realize that ?
So instead of the numbers I would like to insert names into the round time picker.
Here is a sample implementation for the usual time picker.
Upvotes: 0
Views: 236
Reputation: 828
As it turns out from the source code, basically these numbers inside the Circular are just Texts over the Bitmaps.
The basic principle to achieve that goal is to use Canvas class. Canvas holds the "draw" calls. So to draw something, you need 4 basic components:
So we create Paint object and set them text size, color, shadow, etc using Canvas object.
A typical example for using Canvas:
Paint paint = new Paint();
paint.setColor(Color.WHITE);
paint.setStyle(Style.FILL);
canvas.drawPaint(paint);
paint.setColor(Color.BLACK);
paint.setTextSize(20);
canvas.drawText("Text to be drawn", x-co ord, y-co ord, paint obj);
initialize()
method is to change the 3 int arrays defined namely hours
, hours_24
and minutes
to String arrays that you want.
This will make the Texts display "One", "Two", "Three" etc. rather than "1", "2", "3".
Ofcourse, you will have to change the type of other getter/setters or any other methods that calls this initialize() and that relates to these int arrays everywhere.
I hope it helps.
Upvotes: 1