iOS Question Circular ImageView?

BillMeyer

Well-Known Member
Licensed User
In B4i it is quite easy actually.

Go to your Designer, place an imageview on your screen, then look at its size (usually you make it square i.e. let's say 100x100) then you go to Border Properties and set your corner radius to half of the square (in this case 50) of the image and there you have it - a round image !!

upload_2019-9-30_6-9-31.png


and the result is:

upload_2019-9-30_6-11-42.png


Have a great B4X day !!
 

Nicolás Cieri

Active Member
Licensed User
I tried on this way.. but the image is not circular...

Sub DownloadImage(Link As String, mypic As B4XView)
Dim job As HttpJob
job.Initialize("", Me) 'note that the name parameter is no longer needed.
job.Download(Link)
Wait For JobDone(job As HttpJob)
If job.Success Then
'myButton.SetBackgroundImage (job.GetBitmap)
Dim img As B4XBitmap = job.GetBitmap
mypic.SetBitmap(sp.CreateRoundBitmap(img, mypic.Width))
End If
job.Release
End Sub
 

Nicolás Cieri

Active Member
Licensed User
The solution....

Sub DownloadImage(Link As String, mypic As B4XView)
Dim job As HttpJob
job.Initialize("", Me) 'note that the name parameter is no longer needed.
job.Download(Link)
Wait For JobDone(job As HttpJob)
If job.Success Then
'myButton.SetBackgroundImage (job.GetBitmap)
Dim img As B4XBitmap = job.GetBitmap
'mypic.SetBitmap(sp.CreateRoundBitmap(img, mypic.Width))

Dim xIV As B4XView = mypic
xIV.SetBitmap(sp.CreateRoundBitmap(img, xIV .Width))
End If
job.Release
End Sub
 
Top