Android Question Circular Label and positioning

EduardoElias

Well-Known Member
Licensed User
Longtime User
Hi there!

I need to have a circular label, with a number that i choose like this

b165e2a979a3c75f69aef2cfa5f06004--classroom-labels-classroom-design.jpg


And insert this number, like number 10, in a line of the CustomListView.

SO I am going to have many text lines on the customListView, but some when needed will have this label over it, aligned to the right "inside" of the list line. Not all lines will have it, just some when needed.

How can I get make it happen?
 

Peter Simpson

Expert
Licensed User
Longtime User
@eelias I would personally use button, but labels will also work too.
B4X:
'Try this code
    Dim Lbl1 As Label
        Lbl1.Initialize("")

    Activity.AddView(Lbl1, 0dip, 0dip, 100dip, 100dip)
 
    Dim Lbl1Radius As ColorDrawable
        Lbl1Radius.Initialize2(Colors.Yellow, 50, 2dip, Colors.Black)
        Lbl1.Background = Lbl1Radius

    Dim CS As CSBuilder
        CS.Initialize.Color(Colors.DarkGray).VerticalAlign(20dip).Alignment("ALIGN_CENTER").Bold.Size(40).Append("1").PopAll
    Lbl1.Text = CS

Screenshot_1538359433.png


You can use a loop to to dynamically place the labels (buttons) onto the screen, you can then use a sender to see which label (button) was pressed.

You should look at Erels Tic Tac Toe example to dynamically add the labels (buttons) to the screen.

Enjoy...
 
Last edited:
Upvote 0
Top