Android Question 9patch on customListView Items

Endien

Member
Licensed User
Longtime User
You have to work on your borders (fill area) since you have round corners.
Thanks for the reply NJDude.

is my draw9 patch stretch and content design wrong?
or something related with the code on customListView?
 
Upvote 0

Endien

Member
Licensed User
Longtime User
How are you adding the items?

Can you upload the project?

Hi Erel,

B4X:
Sub loadMessage
    Dim Cursor1 As Cursor
    clvInfo.Clear
    Cursor1 = SQL1.ExecQuery("SELECT * FROM MessageInfo ORDER BY DateEntry")
    For i = 0 To Cursor1.RowCount - 1
        Cursor1.Position = i
        addToCvList2("[" & Cursor1.GetString("DateEntry") & "] : " & Cursor1.GetString("MessageContent"), Cursor1.GetString("MessageId"),i)
    Next
    Cursor1.Close
End Sub

Sub addToCvList2(MessageReceived As String, MessageId As Int, index As Int)
   clvInfo.AddTextItem(MessageReceived, MessageId)
   clvInfo.GetPanel(index).Color = Colors.White
   clvInfo.JumpToItem(index)
End Sub

Public Sub AddTextItem(Text As String, Value As Object)
   InsertAtTextItem(items.Size, Text, Value)
End Sub

'Inserts a text item at the specified index.
Public Sub InsertAtTextItem(Index As Int, Text As String, Value As Object)
   Dim pnl As Panel
   pnl.Initialize("")
   Dim lbl As Label
   lbl.Initialize("")
   lbl.Gravity = Bit.OR(Gravity.TOP, Gravity.LEFT)
   pnl.AddView(lbl, 2dip, 2dip, sv.Width - 5dip, 20dip)
   lbl.Text = Text
   lbl.TextSize = DefaultTextSize
   lbl.TextColor = DefaultTextColor
   If DefaultTextBackground <> Null Then
     pnl.Background = DefaultTextBackground
   Else
     pnl.Color = DefaultTextBackgroundColor
   End If

   ModNinePatch.SetNinePatchDrawable(lbl,"infopis")

   Dim minHeight As Int
   minHeight = su.MeasureMultilineTextHeight(lbl, Text)
   lbl.Height = Max(50dip, minHeight)
   InsertAt(Index, pnl, lbl.Height + 2dip, Value)
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…