png in a list

95 views
Skip to first unread message

Alessio Arangia

unread,
Jul 19, 2021, 8:14:34 AM7/19/21
to DroidScript
good morning, i need your help. I need to create a list but my problem is that I have to insert a png to the right of each item in the list, can you help me? thank you

Steve Garman

unread,
Jul 21, 2021, 8:08:57 AM7/21/21
to DroidScript
List controls expect their images on the left

function OnStart()
{
   lay = app.CreateLayout("linear", "VCenter, FillXY")

   lst  = app.AddList(lay)
   lst.SetList( null )
   lst.SetTextSize( 32 )
   lst.SetTextSize2( 32 )
   lst.SetIconSize( 0.2 )
   lst.SetColumnWidths( 0.4, 0.5 )
   lst.AddItem( "One", "Rabbit","/Sys/Img/Bunny.png" )
   lst.AddItem( "Two", "An eagle","/Sys/Img/Eagle1.png" )
   lst.AddItem( "Three", "Another eagle","/Sys/Img/Eagle2.png" )
   lst.AddItem( "Four", "A droid","/Sys/Img/Droid1.png" )
   lst.AddItem( "Five", "Another droid","/Sys/Img/Droid2.png" )

   app.AddLayout(lay)
   var s = app.ListFolder( "/Sys/Img",null,null,"fullPath").join("\n")
   app.SetClipboardText( s  )
}


If you need images on the right you will probably find it easiest to create your own design with one horizontal layout per row and seperate text and image controls for the data

If you are displaying a lot of rows this may be rather slow because of all the traffic over the java bridge

Steve Garman

unread,
Jul 21, 2021, 8:11:50 AM7/21/21
to DroidScript
Apologies for the last 2 lines of code which I was just using to find some .jpg icons

Alessio Arangia

unread,
Jul 22, 2021, 10:43:13 AM7/22/21
to DroidScript

si a me servirebbero a destra delle scritte ma che segua lo scorrere dei nomi della lista
Reply all
Reply to author
Forward
0 new messages