B4A Library JSListView - Simple Native Listview

UPDATE: Library and Samples are uploaded to GitHub

JSListView ~ requires list for DataAdapter
JSListView2 (Latest) ~ requires JSDataAdapter library (also available in github)

There are also sample file which you can download on github.
I also added an example where list item (viewcontainer) contains plus and minus button/

Im a bit busy so i cant respond to all question so just check the provided sample.

Features:
~ Load custom layout for your items, use designer to build your item
~ Uses List and Cursor for your Datasource
~ Uses Adapter Which is set once you set your Datasource
~ Minimum Android: API 11

0.png 1.png 2.png 3.png 4.png 5.png

JSListView
Author:
salvadorjhai
Version: 0.8
  • ItemViewLayout
    Methods:
    • findViewById (id As Int) As View
      Find view by id.
      id: the id
      Return type: @return:the view
    • findViewWithTag (tag As Object) As View
      Find view with tag.
      tag: the tag
      Return type: @return:the view
    • setViewId (v As View, id As Int)
      Set id to view
      v: View
      id:
    Properties:
    • Container As ViewGroup
      Gets the container.
    • Height As Int
      Gets the height.
    • Width As Int
      Gets the width.
  • JSListView
    Events:
    • OnGetView (position As Int, itemLayout As ItemViewLayout, forViewUpdate As Boolean)
    • OnItemClick (view As ItemViewLayout, position As Int)
    • OnItemLongClick (view As ItemViewLayout, position As Int)
    Fields:
    • OVER_SCROLL_ALWAYS As Int
    • OVER_SCROLL_IF_CONTENT_SCROLLS As Int
    • OVER_SCROLL_NEVER As Int
    Methods:
    • BringToFront
    • DesignerCreateView (paramPanelWrapper As PanelWrapper, paramLabelWrapper As LabelWrapper, paramMap As Map)
    • Initialize (eventName As String)
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsFastScrollAlwaysVisible As Boolean
      Returns true if the fast scroller is set to always show on this view.
      Return type: @return:true if the fast scroller will always show
    • IsFastScrollEnabled As Boolean
      Returns true if the fast scroller is enabled.
      Return type: @return:true if fast scroll is enabled, false otherwise
    • IsInitialized As Boolean
    • ItemAdd (data As Object)
      Item add.
      data: the data
    • ItemAddAt (Index As Int, data As Object)
      Add item at specific position
      Index: position
      data: data
    • ItemClearAll
      Clear all item on the listview
    • ItemRemoveAt (position As Int)
      Item remove at.
      position: the position
    • ItemUpdateAt (position As Int, data As Object)
      Item update at.
      position: the position
      data: the new data
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • addFooterView (v As View, data As Object, isSelectable As Boolean)
      Add a fixed view to appear at the bottom of the list. If addFooterView is
      called more than once, the views will appear in the order they were
      added. Views added using this call can take focus if they want.
      NOTE: Call this before calling setAdapter. This is so ListView can wrap
      the supplied cursor with one that will also account for header and footer
      views.
      v: The view to add.
      data: Data to associate with this view
      isSelectable: true if the footer view can be selected
    • addHeaderView (v As View, data As Object, isSelectable As Boolean)
      Add a fixed view to appear at the top of the list. If addHeaderView is
      called more than once, the views will appear in the order they were
      added. Views added using this call can take focus if they want.
      NOTE: Call this before calling setAdapter. This is so ListView can wrap
      the supplied cursor with one that will also account for header and footer
      views.
      v: The view to add.
      data: Data to associate with this view
      isSelectable: whether the item is selectable
    • smoothScrollByOffset (offset As Int)
      Smooth scroll by offset.
      offset: the offset
    • smoothScrollToPosition (position As Int)
      Smooth scroll to position.
      position: the position
    Properties:
    • Background As Drawable
    • CacheColorHint As Int [write only]
      When set to a non-zero value, the cache color hint indicates that this list is always drawn on top of a solid, single-color, opaque background. Zero means that what's behind this object is translucent (non solid) or is not made of a single color.
    • Color As Int [write only]
    • DataSource As List
      Get data source.
    • Divider As Drawable
      Gets the divider.
    • DividerHeight As Int
      Gets the divider height.
    • EmptyView As View
      When the current adapter is empty, the AdapterView can display a special view
      call the empty view. The empty view is used to provide feedback to the user
      that no data is available in this AdapterView.
    • Enabled As Boolean
    • FastScrollAlwaysVisible As Boolean [write only]
      Set whether or not the fast scroller should always be shown in place of the standard scroll bars.
    • FastScrollEnabled As Boolean [write only]
      Specifies whether fast scrolling is enabled or disabled.
    • FooterDividersEnabled As Boolean [write only]
      Sets the footer dividers enabled.
    • HeaderDividersEnabled As Boolean [write only]
      Sets the header dividers enabled.
    • Height As Int
    • ItemsCanFocus As Boolean [read only]
      Gets the items can focus.
    • Left As Int
    • OverScrollMode As Int
      Returns the over-scroll mode for this view. The result will be one of OVER_SCROLL_ALWAYS (default), OVER_SCROLL_IF_CONTENT_SCROLLS (allow over-scrolling only if the view content is larger than the container), or OVER_SCROLL_NEVER.
    • OverscrollFooter As Drawable
      Gets the overscroll footer.
    • OverscrollHeader As Drawable
      Gets the overscroll header.
    • Parent As Object [read only]
    • Selection As Int [write only]
      Sets the selection.
    • Selector As Drawable
      Gets the selector.
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int

B4X:
    ' Process_Globals
    Dim recipes as List

    ' Global
    ' Views from your layout file
    Private JSListView1 As JSListView
    Private ImageView1 As ImageView
    Private Label1 As Label
    Private Label2 As Label

    ' Activity Create
    ' Load your list, im using JSON file for this example
    Dim js As JSONParser
    js.Initialize(File.ReadString(File.DirAssets, "recipes.json"))
    Dim m As Map = js.NextObject
    recipes = m.Get("recipes")

    ' Set your data source
    JSListView1.DataSource = recipes

' Use OnGetView to handle item layout
Sub JSListView1_OnGetView(position As Int, itemLayout As ItemViewLayout, forViewUpdate As Boolean)
    Dim iv As ItemViewLayout = itemLayout

    If forViewUpdate = False Then
        ' Load layout to panel (REQUIRED)
        Dim p As Panel
        p.Initialize("")
        p.LoadLayout("TwoLineAndBitmap")
 
        ' assign this panel to ItemViewLayout (REQUIRED)
        iv.Container = p
 
        ' since B4A doesn't use setID, will use tag instead
        ' tag is needed so set it (REQUIRED)
        Label1.Tag = 1
        Label2.Tag = 2
        ImageView1.Tag = 3
 
        ' Custom adjustment on our layout
        Label1.Width = 100%x - Label1.Left - 10dip
        Label2.Width = 100%x - Label2.Left - 10dip
 
        '
        Label1.Typeface = Typeface.LoadFromAssets("JosefinSans-Bold.ttf")
        Label2.Typeface = Typeface.LoadFromAssets("JosefinSans-SemiBoldItalic.ttf")
        Label1.Gravity = Gravity.TOP
        Label2.Gravity = Gravity.TOP
    
        ' Set the Width and Height of your item layout (ItemViewLayout) (REQUIRED)
        iv.Height = ImageView1.Top + ImageView1.Height + 10dip
        iv.Width = 100%x
 
        ' some more adjustment to our item
        Label1.Height = 15dip
        Label2.Top = Label1.Top + Label1.Height
        Label2.Height = iv.Height - Label2.Top - 10dip
    End If

    ' im using json
    ' get fields from recipes (json)
    Dim mapper As Map = recipes.Get(position)

    ' get views (REQUIRED), else android will get confuse which view it is.
    Label1 = iv.findViewWithTag(1)
    Label2 = iv.findViewWithTag(2)
    ImageView1 = iv.findViewWithTag(3)

    ' set data
    Label1.Text = mapper.Get("title")
    Label2.Text = mapper.Get("description")

    ' load image from web
    Dim picaso As Picasso
    picaso.Initialize
    picaso.LoadUrl(mapper.Get("image")).Resize(ImageView1.Width,ImageView1.Height).CenterCrop.IntoImageView(ImageView1)

End Sub

Attached is the Library which you will extract on your Additional Library Folder

Sample project is also attached.

You will need the following to run this example:
1. Picasso Library
2. AppCompat
3. JSON - i think this is built in library
 

Attachments

  • JSListView_example.zip
    126.3 KB · Views: 944
  • JSListView_r6.zip
    15.8 KB · Views: 607
  • JSListView_r8.zip
    15.9 KB · Views: 809
Last edited:

SNOUHyhQs2

Member
Licensed User
Longtime User
Hello my friend,
I tried your custom listview on my project, everything works fine except onClick event and my custom listview does not have ripple effect.
Thank you for your time.

what is your android version?

onclick event works on my anndroid 4.4.4 (acer tablet) and android 7.1.1 (xiaomi redmi 1s). and the event for click is called OnItemClick.

riffle effect also works with 7.1.1, not sure if riffle effect is available on lower android version.
 

yiankos1

Well-Known Member
Licensed User
Longtime User
what is your android version?

onclick event works on my anndroid 4.4.4 (acer tablet) and android 7.1.1 (xiaomi redmi 1s). and the event for click is called OnItemClick.

riffle effect also works with 7.1.1, not sure if riffle effect is available on lower android version.
Thank you for your answer, when I try your sample, everything is fine and working both of them. Now, when I try to implement this code in my project, does have these two features. Two things are different from your sample, my app is appcompat and I created my own custom list view layout.
Moreover, my android api is 21.
Thank you for your time.
 

SNOUHyhQs2

Member
Licensed User
Longtime User
Thank you for your answer, when I try your sample, everything is fine and working both of them. Now, when I try to implement this code in my project, does have these two features. Two things are different from your sample, my app is appcompat and I created my own custom list view layout.
Moreover, my android api is 21.
Thank you for your time.

try to upload part of your project with listview implementation so i can check.
 

yiankos1

Well-Known Member
Licensed User
Longtime User
try to upload part of your project with listview implementation so i can check.
Here is .bas file and .bal file consists of a appcompat toolbar and your listview.
 

Attachments

  • wods.bas
    4 KB · Views: 234

SNOUHyhQs2

Member
Licensed User
Longtime User
Here is .bas file and .bal file consists of a appcompat toolbar and your listview.

im expecting a project file so i can just run it on my side....
anyway. i tried creating a project base on AppCompatBase with search view example and it works just fine. toast message is showing, tested on android 7.1.1.
 

Attachments

  • JSListView_example-appbasecompat.zip
    19.1 KB · Views: 409

yiankos1

Well-Known Member
Licensed User
Longtime User
im expecting a project file so i can just run it on my side....
anyway. i tried creating a project base on AppCompatBase with search view example and it works just fine. toast message is showing, tested on android 7.1.1.
Thank you very much for this source code, i will try to find what is the problem in my app. Moreover this json search, helped me a lot!
 

yiankos1

Well-Known Member
Licensed User
Longtime User
im expecting a project file so i can just run it on my side....
anyway. i tried creating a project base on AppCompatBase with search view example and it works just fine. toast message is showing, tested on android 7.1.1.
My friend @SNOUHyhQs2 , i figured out! My custom layout consists of 3 labels, 1 imageview and 3 buttons. When i delete buttons everything works fine(click event fired and there is ripple effecy). But if my custom layout has a button does not do anything of them. Is there any way to support more views and a second question is there any way to catch button_click event of the specific item of a list view.
Thank you for your time.

Edit: I tried to find a way for button_click event, but there is no get option from this custom listview in order to use it with sender
 
Last edited:

SNOUHyhQs2

Member
Licensed User
Longtime User
My friend @SNOUHyhQs2 , i figured out! My custom layout consists of 3 labels, 1 imageview and 3 buttons. When i delete buttons everything works fine(click event fired and there is ripple effecy). But if my custom layout has a button does not do anything of them. Is there any way to support more views and a second question is there any way to catch button_click event of the specific item of a list view.
Thank you for your time.

Edit: I tried to find a way for button_click event, but there is no get option from this custom listview in order to use it with sender

Okay, it seems that click and rifflle effect doesnt work if list item contains button.

7.png


So better handle the item click on your button or maybe use image for click event instead of button.
 

yiankos1

Well-Known Member
Licensed User
Longtime User
Okay, it seems that click and rifflle effect doesnt work if list item contains button.

View attachment 51663

So better handle the item click on your button or maybe use image for click event instead of button.
I tried to find a way for button_click event, but there is no get option from this custom listview in order to use it with sender. Do you have any idea how to catch click event even if I add imageview instead of a button
 

SNOUHyhQs2

Member
Licensed User
Longtime User
I tried to find a way for button_click event, but there is no get option from this custom listview in order to use it with sender. Do you have any idea how to catch click event even if I add imageview instead of a button

you can always generate event using the designer.

8.png
 

Douglas Farias

Expert
Licensed User
Longtime User
@SNOUHyhQs2
HI.
i m note tedted your lib, but i have a question.
what the diference of your lib and clv by erel?
performace or another option?

thx
 

SNOUHyhQs2

Member
Licensed User
Longtime User
@SNOUHyhQs2
HI.
i m note tedted your lib, but i have a question.
what the diference of your lib and clv by erel?
performace or another option?

thx

CLV - You add, update, and remove views directly - good for small listed items i think.

jslistview uses DataSource (Adapter) - currently uses List for now but im planning on adding support for Cursor.
you perform CRUD operations in the Datasource and not on the View.
Views (item layout) are Loaded/Re-used in _OnGetView event.

Think of it as a wrap of the original android listview that uses adapter.

Just try the sample and you will see.
 

yiankos1

Well-Known Member
Licensed User
Longtime User
you can always generate event using the designer.

View attachment 51664
Good morning, I don't mean exactly this click event. I know how to add this. I mean, when I click this button from an item of a listview, how to get the specific label1.text and label2.text. Do you understand me?
 

SNOUHyhQs2

Member
Licensed User
Longtime User
Good morning, I don't mean exactly this click event. I know how to add this. I mean, when I click this button from an item of a listview, how to get the specific label1.text and label2.text. Do you understand me?

Still work in progress but you can try and use latest library R8.

Not even sure if this will work correctly but here:
B4X:
Try
  Dim iv As ItemViewLayout = itemLayout

  Dim p As Panel
  If forViewUpdate = False Then
  p.Initialize("")
  p.LoadLayout("twolineandbitmapbuttons")
  iv.Container = p
     ' use setViewId. B4A does not support this natively so will just rely on this function for now.
  iv.setViewId(Label1, 1)
  iv.setViewId(Label2, 2)
  iv.setViewId(ImageView1, 3)
     iv.setViewId(btnViewDetails, 4)
     iv.setViewId(btnRemoveDetails, 5)
     ...
  End If
   
  ' get data to map
  Dim mapper As Map = JSListView1.DataSource.Get(position)
   
   ' find our views
  Label1 = iv.findViewById(1)
  Label2 = iv.findViewById(2)   
  ImageView1 = iv.findViewById(3)   
  btnViewDetails = iv.findViewById(4)
  btnRemoveDetails = iv.findViewById(5)
   
   ' display some values
  Label1.Text = mapper.Get("fullname")
  Label2.Text = mapper.Get("slogan")

   ' assign other data to tag properties
  ImageView1.Tag = mapper
  btnViewDetails.Tag = mapper  
  btnRemoveDetails.Tag = position
   
   ' or you can assign the position and access this data using JSListView1.DataSource.Get(position)
  'ImageView1.Tag = position
  'btnViewDetails.Tag = position
  'btnRemoveDetails.Tag = position
   
   ' load image async
  Dim picaso As Picasso
  picaso.Initialize
  picaso.LoadUrl(mapper.Get("avatar")).Resize(ImageView1.Width,ImageView1.Height).CenterCrop.IntoImageView(ImageView1)

Catch
  Log(LastException)
End Try
 

yiankos1

Well-Known Member
Licensed User
Longtime User
Still work in progress but you can try and use latest library R8.

Not even sure if this will work correctly but here:
B4X:
Try
  Dim iv As ItemViewLayout = itemLayout

  Dim p As Panel
  If forViewUpdate = False Then
  p.Initialize("")
  p.LoadLayout("twolineandbitmapbuttons")
  iv.Container = p
     ' use setViewId. B4A does not support this natively so will just rely on this function for now.
  iv.setViewId(Label1, 1)
  iv.setViewId(Label2, 2)
  iv.setViewId(ImageView1, 3)
     iv.setViewId(btnViewDetails, 4)
     iv.setViewId(btnRemoveDetails, 5)
     ...
  End If
  
  ' get data to map
  Dim mapper As Map = JSListView1.DataSource.Get(position)
  
   ' find our views
  Label1 = iv.findViewById(1)
  Label2 = iv.findViewById(2)  
  ImageView1 = iv.findViewById(3)  
  btnViewDetails = iv.findViewById(4)
  btnRemoveDetails = iv.findViewById(5)
  
   ' display some values
  Label1.Text = mapper.Get("fullname")
  Label2.Text = mapper.Get("slogan")

   ' assign other data to tag properties
  ImageView1.Tag = mapper
  btnViewDetails.Tag = mapper 
  btnRemoveDetails.Tag = position
  
   ' or you can assign the position and access this data using JSListView1.DataSource.Get(position)
  'ImageView1.Tag = position
  'btnViewDetails.Tag = position
  'btnRemoveDetails.Tag = position
  
   ' load image async
  Dim picaso As Picasso
  picaso.Initialize
  picaso.LoadUrl(mapper.Get("avatar")).Resize(ImageView1.Width,ImageView1.Height).CenterCrop.IntoImageView(ImageView1)

Catch
  Log(LastException)
End Try
Hello @SNOUHyhQs2, this sample code what is supposed to do? Because, as i see it needs "position" variable but this click_event will never be raised (cause button), so how will get position variable? In order to get specific item of a listview, you need something like this with sender variable:
B4X:
Sub clvApplyButton_Click

    Dim index As Int = clv.GetItemFromView(Sender)
    Dim pnl As Panel = clv.GetPanel(index)
    Dim lbl As Label = pnl.GetView(1)
    Log(lbl.text)

End Sub
Moreover, what is new with library r.8 ?
 

yiankos1

Well-Known Member
Licensed User
Longtime User
Hello my friend,
Is there any way to change the height of each list item dynamically? I tried string utils in order to set the correct height of the list item but throws an error.
Error occurred on line: 307 (wods)
java.lang.IllegalArgumentException: Layout: -291 < 0
at android.text.Layout.<init>(Layout.java:142)
at android.text.StaticLayout.<init>(StaticLayout.java:106)
at android.text.StaticLayout.<init>(StaticLayout.java:92)
at android.text.StaticLayout.<init>(StaticLayout.java:70)
at android.text.StaticLayout.<init>(StaticLayout.java:50)
at anywheresoftware.b4a.objects.StringUtils.MeasureMultilineTextHeight(StringUtils.java:32)
at com.dreamon.crosswodtimer.wods._jslistview1_ongetview(wods.java:510)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:708)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:340)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:157)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
at com.salvadorjhai.widgets.JSListView$SimpleListAdapter.getView(JSListView.java:576)
at android.widget.AbsListView.obtainView(AbsListView.java:2823)
at android.widget.ListView.makeAndAddView(ListView.java:1889)
at android.widget.ListView.fillDown(ListView.java:713)
at android.widget.ListView.fillFromTop(ListView.java:779)
at android.widget.ListView.layoutChildren(ListView.java:1698)
at android.widget.AbsListView.onLayout(AbsListView.java:2627)
at android.view.View.layout(View.java:16711)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at anywheresoftware.b4a.BALayout.onLayout(BALayout.java:43)
at android.view.View.layout(View.java:16711)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:16711)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:16711)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:16711)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1702)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1556)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1465)
at android.view.View.layout(View.java:16711)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:16711)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2319)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2032)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1191)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6642)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
at android.view.Choreographer.doCallbacks(Choreographer.java:590)
at android.view.Choreographer.doFrame(Choreographer.java:560)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5942)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
Message longer than Log limit (4000). Message was truncated.

and here is the code:

B4X:
Sub JSListView1_OnGetView(position As Int, itemLayout As ItemViewLayout, forViewUpdate As Boolean)
    Log($"JSListView1_OnGetView @ Position: ${position}"$)
   
    Dim iv As ItemViewLayout = itemLayout
   
    Dim mapper As Map = JSListView1.DataSource.Get(position)


   
    Dim p As Panel
    p.Initialize("")
    If forViewUpdate = False Then
        p.LoadLayout("customlistview")
        iv.Container = p

        clvLabel.Tag = 1
        clvInfo.Tag = 2
        clvSub.Tag = 3
        clvType.Tag = 4
        clvImage.Tag = 5
        'clvApply.Tag = 5
        'clvComment.Tag = 6
        'clvLike.Tag = 7
       
        Private su As StringUtils
        clvLabel.Height=su.MeasureMultilineTextHeight(clvLabel,mapper.Get("id") & mapper.Get("name"))
        clvInfo.Top=clvLabel.Top+clvLabel.Height+5dip
        clvInfo.Height=su.MeasureMultilineTextHeight(clvInfo,mapper.Get("info"))
        clvSub.Top=clvInfo.Top+clvInfo.Height+5dip
        clvSub.Height=su.MeasureMultilineTextHeight(clvSub,mapper.Get("type"))

        iv.Height=su.MeasureMultilineTextHeight(clvLabel,clvLabel.Text)+su.MeasureMultilineTextHeight(clvInfo,clvInfo.Text)+su.MeasureMultilineTextHeight(clvSub,clvSub.Text)
   

        iv.Width = 100%x
    End If

    clvLabel = iv.findViewWithTag(1)
    clvInfo = iv.findViewWithTag(2)
    clvSub = iv.findViewWithTag(3)
    clvType = iv.findViewWithTag(4)
    clvImage = iv.findViewWithTag(5)
    'clvApply = iv.findViewWithTag(5)
    'clvComment = iv.findViewWithTag(6)
    'clvLike = iv.findViewWithTag(7)

    clvLabel.Text = mapper.Get("id") & mapper.Get("name")
    If m.Get("info")<>"" Then
        clvInfo.Text = mapper.Get("info")
    End If
    clvType.Text = mapper.Get("type")
    clvSub.Text = mapper.Get("wod")
   

   
    p = iv.Container
    If position Mod 2 = 0 Then
        p.Color = Colors.Transparent
    Else
        p.Color = Colors.ARGB(20, 100, 100, 100)
    End If
   
   
   
End Sub
 
Top