Android Question how to set Canvas Position

Gianni Sassanelli

Active Member
Licensed User
Longtime User
Hi,
i need to move a label drawed by a Canvas.

i use the following Erel's example code to set a label with a Canvas

B4X:
Dim Cnv As Canvas
Cnv.Initialize(Activity)
Dim cjo As JavaObject = cvs

Dim jv As JavaObject = lblText   'lbltext is a label inserted into layout used by activity
jv.RunMethod("draw", Array(cjo.GetFieldJO("canvas")))  ' this draw the label

' but the label is positioned at 0,0
' i need to move that to 100dip, 50dip and Don't know how to
' IS this possible ?
thank's
 

stevel05

Expert
Licensed User
Longtime User
That method will only draw the label at the 0,0 position. You will need to use a second Canvas and draw the bitmap from the first canvas in the position you require.

The attached project is an example.
 

Attachments

  • CDT.zip
    9.1 KB · Views: 142
Upvote 0
Top