将数据存储在行列表中

时间:2019-11-14 09:45:13

标签: roku brightscript

我像下面的XML一样创建我的行列表。

id = "CRowList"
      translation = "[ 0, 100]" 
      numRows = "15" 
      itemSize = "[ 130, 70 ]" 
      rowItemSize = "[ [90, 70],[90,70],[90,70] ]" 
      rowItemSpacing="[[54,0],[18,0]]"
      rowLabelOffset="[[0,8]]"
      itemSpacing = "[ 0, 10 ]" 
      showRowCounter="[true]"
      showRowLabel = "[ true, true ]" 
      drawFocusFeedback = "false" 
      vertFocusAnimationStyle = "fixedFocusWrap" 
      rowFocusAnimationStyle = "fixedFocusWrap" />

,然后在brs文件中提取数据,如下所示。在这里,我使用了xmlreader的自定义组件。它表现为xml从服务器接收的数据。 我试图像下面的图像一样进行设置,并且我还引用了一个简单的RowList示例。在这里RowList。我想在这里在Content内部创建一个Content。像家长内容或孩子内容。我设置了父级内容,但是,其行为仅像在图像第1行和第2行下方显示标题一样,并且海报和标签数据来自子级内容。但是我不知道该怎么设置。

enter image description here

function init()

    ?"hello init() "

    m.CRowList = m.top.findNode("CRowList")
    m.readPosterGridTask = createObject("roSGNode", "XmlReader")
    m.readPosterGridTask.contenturi = "http://192.168.1.3/?file=AllChannel.xml"
    m.readPosterGridTask.observeField("content", "setpanels")
    m.readPosterGridTask.control = "RUN" 


    ?"hello rowlist"
    m.top.setFocus(true)

end function

function setpanels()

   ' ?"m.CRowList : " m.CRowList.content
    m.CRowList.content = m.readPosterGridTask.content 'here set bydefault to row title.
    i = 0
    while i < m.CRowList.content.getChildCount()
        ?"here displaya a data  : " m.CRowList.content.getChild(i).title
        ?"here hdposter url : "m.CRowList.content.getChild(i).hdposterurl
        i = i + 1
    end while
end function

在我的xml数据中,三个项目标签和每个标签两个属性1)标题和2)hdposterurl。 但是我无法像下面的图像那样在此处进行设置。谢谢。

1 个答案:

答案 0 :(得分:0)

昨天我实际上只是在尝试使用RowList,但遇到了非常相似的问题。

我想尝试找出使用RowList的适当方法,因此我下载了RowList example referenced by the Docs并运行了它。

运行时,尽管这些海报具有有效的uri,但我可以看到部分标题,但看不到海报中的图像。

我认为RowList本身存在错误,建议您改用MarkupGrid。它提供了许多相同的功能,同时更易于使用和减少了错误。

相关问题