如何创建行列表,其中项目宽度基于文本,

时间:2019-05-08 15:27:34

标签: roku brightscript

我需要使用文本创建行列表,其中项目宽度基于项目文本 请检查所附图片以供参考,

Here need to change "Breaking new" text item width as per text length.

1 个答案:

答案 0 :(得分:0)

此处为图片的XML组件:

<PosterGrid 
      id = "ChannelPosterGrid" 
      translation = "[ 10 , 10 ]"      
      caption1NumLines = "2" 
      caption2NumLines = "2"
      numColumns="4"
      numRows="6"
      focusBitmapUri="pkg:/images/imagegrid.png"
      itemSpacing = "[ 20, 20 ]" /> 

首先,使用init()函数在后网格中查找ID m.top.grid = m.top.findNode("ChannelPosterGrid")

用于显示原始列表的明亮脚本代码:

sub showpostergrid()
? " I am in showpostergrid() "
  m.top.grid.content = m.readPosterGridTask.content
' m.top.grid.FHDPosterUrl = m.readPosterGridTask.hdposterurl
end sub

用于读取原始列表的明亮脚本代码:

sub readpostergrid()

'? "I am in readpostergrid() " m.top.gridcontenturi

  'the code of roPosterGrid
  m.ChannelPosterGrid = m.top.FindNode("ChannelPosterGrid")
  m.readPosterGridTask = createObject("roSGNode", "XmlReader")
' screen = createobject("roParagraphScreen")
' m.readPosterGridTask.backgroundColor = "008000"
  m.readPosterGridTask.contenturi = m.top.gridcontenturi
  m.readPosterGridTask.observeField("content", "showpostergrid")
' m.readPosterGridTask.contenturi = "pkg:/xml/AllChannel.xml"
' m.readPosterGridTask.contenturi = "http://api.delvenetworks.com/rest/organizations/59021fabe3b645968e382ac726cd6c7b/channels/1cfd09ab38e54f48be8498e0239f5c83/media.rss" 'Roku rss XML
  m.readPosterGridTask.color = "008000"
' screen.AddParagraph("Hello Nikunj")
  m.readPosterGridTask.control = "RUN"
end sub