如何控制Roku场景图中进度对话框的背景不透明度?
How to control the background opacity of progress dialog in Roku scene graph?
我正在使用 main.brs 代码来显示进度加载对话框。如果我将此代码用于进度对话框,则其默认背景将占据整个屏幕。在这里我只想显示进度加载动画和背景应该是透明的。谁能帮忙解决这个问题。
'Main.brs
ShowLoading = CreateObject("roSGScreen")
ShowLoading.CreateScene("ProgressDialogExample")
ShowLoading.show()
'ProgressDialogExample.Xml
<component name = "ProgressDialogExample" extends = "Scene">
<script type = "text/brightscript" >
<![CDATA[
sub init()
progressdialog = createObject("roSGNode", "ProgressDialog")
progressdialog.title = "Loading..."
m.top.dialog = progressdialogs
m.top.setFocus(true)
end sub
]]>
</script>
</component>
ProgressDialog
内部使用了一个名为BusySpinner
的特殊节点class。您可以将它与标签一起使用以获得具有透明背景的进度对话框。
将以下代码添加到文件 ProgressDialogExample.Xml:
<children>
<Group>
<BusySpinner
id="spinner"
translation="[570, 300]"
control="start"
clockwise="true"
spinInterval="2" />
<Label
id="lblLoding"
horizAlign="center"
text="Loading"
color="0x6c3b97ff"
font="font:LargeBoldSystemFont"
translation="[620, 300]" />
</Group>
</children>
此外,将图像添加到文件夹 "images" 以用作加载图像。
然后,在Main.brs中添加如下代码:
spinner = m.top.FindNode("spinner")
spinner.poster.uri="pkg:/images/loader.png"
我正在使用 main.brs 代码来显示进度加载对话框。如果我将此代码用于进度对话框,则其默认背景将占据整个屏幕。在这里我只想显示进度加载动画和背景应该是透明的。谁能帮忙解决这个问题。
'Main.brs
ShowLoading = CreateObject("roSGScreen")
ShowLoading.CreateScene("ProgressDialogExample")
ShowLoading.show()
'ProgressDialogExample.Xml
<component name = "ProgressDialogExample" extends = "Scene">
<script type = "text/brightscript" >
<![CDATA[
sub init()
progressdialog = createObject("roSGNode", "ProgressDialog")
progressdialog.title = "Loading..."
m.top.dialog = progressdialogs
m.top.setFocus(true)
end sub
]]>
</script>
</component>
ProgressDialog
内部使用了一个名为BusySpinner
的特殊节点class。您可以将它与标签一起使用以获得具有透明背景的进度对话框。
将以下代码添加到文件 ProgressDialogExample.Xml:
<children>
<Group>
<BusySpinner
id="spinner"
translation="[570, 300]"
control="start"
clockwise="true"
spinInterval="2" />
<Label
id="lblLoding"
horizAlign="center"
text="Loading"
color="0x6c3b97ff"
font="font:LargeBoldSystemFont"
translation="[620, 300]" />
</Group>
</children>
此外,将图像添加到文件夹 "images" 以用作加载图像。 然后,在Main.brs中添加如下代码:
spinner = m.top.FindNode("spinner")
spinner.poster.uri="pkg:/images/loader.png"