Hi group.
This is a wrapper to a rounded ImageView ( and oval & circular ) that i needed for a small project.
Credits go to https://github.com/vinc3m1/RoundedImageView
Sample code :
Source code is included, in case someone needs to do some changes/bugfixes.
Nelson
This is a wrapper to a rounded ImageView ( and oval & circular ) that i needed for a small project.
Credits go to https://github.com/vinc3m1/RoundedImageView
Sample code :
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim rIv1, rIv2 , rIv3 As RoundedImageView
Dim b As Bitmap
Dim xImgSize As Int
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
b.Initialize(File.DirAssets,"bart.jpg")
rIv1.Initialize("iv")
rIv1.ImageBitmap=b
rIv1.ScaleType=rIv1.SCALETYPE_FIT_XY
Activity.AddView(rIv1,10%x,5%y,80%x,25%y)
rIv2.Initialize("iv")
rIv2.ImageBitmap=b
rIv2.ScaleType=rIv2.SCALETYPE_CENTER_CROP
rIv2.Oval=False
rIv2.CornerRadius=30
Activity.AddView(rIv2,10%x,33%y,80%x,25%y)
rIv3.Initialize("iv")
rIv3.ImageBitmap=b
rIv3.ScaleType=rIv3.SCALETYPE_FIT_XY
rIv3.Oval=True
rIv3.CornerRadius=90
xImgSize= 25%x * 100%y/100%x
Dim States(3,1) As Int
States(0,0) = 16842919 'Pressed
States(1,0) = 16842910 'Enabled
States(2,0) = -16842910 'Disabled
Dim Color(3) As Int = Array As Int(Colors.blue,Colors.white,Colors.Red)
rIv3.setBorderColors(States,Color)
rIv3.BorderWidth=3dip
Activity.AddView(rIv3,50%x-xImgSize/2,66%y,xImgSize,25%y)
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub iv_Click
Msgbox("Click","msg")
End Sub
Sub iv_LongClick
Msgbox("Long click","msg")
End Sub
Source code is included, in case someone needs to do some changes/bugfixes.
Nelson