MR.B4A 252 ارسال شده در 9 شهریور اشتراک گذاری ارسال شده در 9 شهریور یک لیست ویوی بسیار زیبا و مدرن با قابلیت کلیک سورس: ⭕ صفحه اول Sub Process_Globals Dim Bitmap As Bitmap End Sub Sub Globals Private xui As XUI Private ImageView1 As B4XView Private T As Label Private Button1 As Button Private Label1 As Label Private Button1 As Button Private CLV As CustomListView Private Panel1 As Panel Private Button2 As Button Dim Counter As Int End Sub Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("Layout") End Sub Private Sub activity_PermissionResult (Permission As String, Result As Boolean) End Sub Private Sub CreateItem(Width As Int, Title As String, Image As B4XBitmap,Date As String) As Panel Dim p As B4XView = xui.CreatePanel("") Dim height As Int = 120dip Dim Obj1 As Reflector p.SetLayoutAnimated(0, 0, 0, Width, height) p.LoadLayout("card") T.Text = Title Dim ripple As RippleView ripple.Initialize(Panel1, Colors.Blue, 300, True) Label1.TextColor = 0xFF4A0091 Label1.Text = " Tel : @SkillPersian"&CRLF&Date ImageView1.SetBitmap(CreateRoundBitmap(Image, ImageView1.Width)) Obj1.Target = T Obj1.RunMethod3("setLineSpacing", 1, "java.lang.float", 1.2, "java.lang.float") Return p End Sub Sub CreateRoundBitmap (Input As B4XBitmap, Size As Int) As B4XBitmap If Input.Width <> Input.Height Then 'if the image is not square then we crop it to be a square. Dim l As Int = Min(Input.Width, Input.Height) Input = Input.Crop(Input.Width / 2 - l / 2, Input.Height / 2 - l / 2, l, l) End If Dim c As B4XCanvas Dim xview As B4XView = xui.CreatePanel("") xview.SetLayoutAnimated(0, 0, 0, Size, Size) c.Initialize(xview) Dim path As B4XPath path.InitializeOval(c.TargetRect) c.ClipPath(path) c.DrawBitmap(Input.Resize(Size, Size, False), c.TargetRect) c.RemoveClip c.DrawCircle(c.TargetRect.CenterX, c.TargetRect.CenterY, c.TargetRect.Width / 2 - 2dip, xui.Color_White, False, 5dip) 'comment this line to remove the border c.Invalidate Dim res As B4XBitmap = c.CreateBitmap c.Release Return res End Sub 'درصورت فعال بودن Ripple View 'کلیک آیتم از کار می افته بنابرین باید 'seneder 'برای دسترسی به کلیک آیتم ها استفاده کنید Sub CLV_ItemClick (Index As Int, Value As Object) ToastMessageShow(Value,False) End Sub Private Sub Panel1_Click Dim index As Int = CLV.GetItemFromView(Sender) ToastMessageShow("آیتم شماره "&CLV.GetValue(index)&" کلیک شد. ",False) End Sub Private Sub Button1_Click Dim index As Int = CLV.GetItemFromView(Sender) ToastMessageShow("مشاهده آیتم "&CLV.GetValue(index),False) End Sub Private Sub Button2_Click For i= 0 To 10 Bitmap= LoadBitmap(File.DirAssets,i&".jpg") Counter = Counter +1 CLV.Add(CreateItem(CLV.AsView.Width,"Mohammad Reza Pirzadeh"&CRLF&"Skillpersian",Bitmap,""),Counter) Next End Sub Private Sub btn_next_Click Activity.Finish StartActivity("page2") End Sub ✅ صفحه دوم Sub Process_Globals Dim Bitmap As Bitmap End Sub Sub Globals Private xui As XUI Private ImageView1 As B4XView Private T As Label Private Button1 As Button Private Label1 As Label Private Button1 As Button Private CLV As CustomListView Private Panel1 As Panel Dim Counter As Int Private i As Int End Sub Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("page2") End Sub Private Sub CreateItem(Width As Int, Title As String, Image As B4XBitmap,Date As String) As Panel Dim p As B4XView = xui.CreatePanel("") Dim height As Int = 120dip Dim Obj1 As Reflector p.SetLayoutAnimated(0, 0, 0, Width, height) p.LoadLayout("card") T.Text = Title Dim ripple As RippleView ripple.Initialize(Panel1, Colors.Blue, 300, True) Label1.TextColor = 0xFF4A0091 Label1.Text = " Tel : @SkillPersian"&CRLF&Date ImageView1.SetBitmap(CreateRoundBitmap(Image, ImageView1.Width)) Obj1.Target = T Obj1.RunMethod3("setLineSpacing", 1, "java.lang.float", 1.2, "java.lang.float") Return p End Sub Sub CreateRoundBitmap (Input As B4XBitmap, Size As Int) As B4XBitmap If Input.Width <> Input.Height Then 'if the image is not square then we crop it to be a square. Dim l As Int = Min(Input.Width, Input.Height) Input = Input.Crop(Input.Width / 2 - l / 2, Input.Height / 2 - l / 2, l, l) End If Dim c As B4XCanvas Dim xview As B4XView = xui.CreatePanel("") xview.SetLayoutAnimated(0, 0, 0, Size, Size) c.Initialize(xview) Dim path As B4XPath path.InitializeOval(c.TargetRect) c.ClipPath(path) c.DrawBitmap(Input.Resize(Size, Size, False), c.TargetRect) c.RemoveClip c.DrawCircle(c.TargetRect.CenterX, c.TargetRect.CenterY, c.TargetRect.Width / 2 - 2dip, xui.Color_White, False, 5dip) 'comment this line to remove the border c.Invalidate Dim res As B4XBitmap = c.CreateBitmap c.Release Return res End Sub 'درصورت فعال بودن Ripple View 'کلیک آیتم از کار می افته بنابرین باید 'seneder 'برای دسترسی به کلیک آیتم ها استفاده کنید Sub CLV_ItemClick (Index As Int, Value As Object) ToastMessageShow(Value,False) End Sub Private Sub Panel1_Click Dim index As Int = CLV.GetItemFromView(Sender) ToastMessageShow("آیتم شماره "&CLV.GetValue(index)&" کلیک شد. ",False) End Sub Private Sub Button1_Click Dim index As Int = CLV.GetItemFromView(Sender) ToastMessageShow("مشاهده آیتم "&CLV.GetValue(index),False) End Sub Private Sub Button2_Click If i=11 Then ToastMessageShow("همه آیتم ها ساخته شدند",False) Return End If Bitmap= LoadBitmap(File.DirAssets,i&".jpg") i=i+1 Counter = Counter +1 CLV.Add(CreateItem(CLV.AsView.Width,"Mohammad Reza Pirzadeh"&CRLF&"Skillpersian",Bitmap,""),Counter) End Sub Private Sub activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event Activity.Finish StartActivity("main") Return True End Sub تهیه و تنظیم مرتضی صباغی MR.B4A https://eitaa.com/basic4androidlan https://t.me/programmingwithb4a 1 نقل قول لینک ارسال به اشتراک گذاری در سایت های دیگر تنظیمات بیشتر اشتراک گذاری ...
ارسالهای توصیه شده
به گفتگو بپیوندید
هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .
توجه: strong> مطلب ارسالی شما پس از تایید مدیریت برای همه قابل رویت خواهد بود.