首页 > 解决方案 > 如何在 PosterGridView 上设置背景图像

问题描述

我正在使用 PosterGridView 并在 Roku 中显示多张海报。我在海报中使用透明图像。有没有办法使用海报网格来改变背景,比如白色或蓝色? 在此处输入图像描述

我使用了如下海报网格视图:

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

在 .brs 文件中访问就像简单:

m.top.grid = m.top.findNode("ChannelPosterGrid")

我尝试了三件事:

m.top.grid.backgroundURI = "pkg:/images/myImage.jpg" 'not work
m.top.backgroundURI = "pkg:/images/myImage.jpg" 'not work
scene.backgroundURI = "pkg:/images/white.jpg" 'Its set hole screen background 'scene is object of roSGScreen  

编辑:

在这里,我使用 hdposterurl 和 sdposterurl 设置图像。但是,在这里我得到了一个黑色的透明图像。而且我的背景也是黑色的。因此,图像与背景混合在一起。所以,我需要找到一种方法在图像后面放置一个白色矩形。使用 RowList 是可能的。因为在 RowList 中使用了 Poster 节点。但是,我尝试使用 PosterGrid 找出答案。

我试过这个字段(imageWellBitmapUri)。但是,在我的情况下,它不适用于空海报网格。我试图在黑色透明图像后面放置一个白色图像或矩形。我需要它,因为这里我的图像是黑色透明的,我的背景也是黑色的。因此,图像与背景合并。我想在 PosterGrid 中做这样的事情。这里是海报节点中的示例。

<Rectangle id="testRectangle" color="0xFFFFFFFF">
<Poster id="poster"/>
</Rectangle>

标签: rokubrightscript

解决方案


我不是 100% 清楚你在这里问什么

我在海报中使用透明图像。有没有办法使用海报网格来改变背景,比如白色或蓝色?

posterGrid组件没有backgroundURI 我能找到的字段。

我知道您可以使用rectangle组件在屏幕上的任何位置和相对 z-index 处制作彩色背景。如果您想使用 a .jpgthen 您还可以创建一个新的子组件poster并将其插入到需要的位置。子插入顺序决定了 z-index。如果您尝试将其添加到 anitemComponent那么您可能需要一定程度的黑客攻击才能使其正常工作,但是 lmk.


推荐阅读