为什么行列表所有行中的项目在 brightscript 中重复
Why the items in all the rows of row list are getting repeated in brightscript
我正在尝试使用包含 3 行的行列表。每行将包含 11 个项目。但是当它显示时,在 11 个项目之后,所有行中的项目再次重复。
下面是 XML 个文件。
BrowseScreen.xml
<?xml version="1.0" encoding="utf-8" ?>
<component name="BrowseScreen" extends="Group">
<children>
<!-- The main content -->
<RowList id="BrowseRowList"
itemComponentName="customItem"
focusXOffset="[0]"
itemSize="[1920,500]"
numRows="3"
drawFocusFeedback="false"
rowFocusAnimationStyle="fixedFocusWrap"
rowHeights="[500]"
showRowLabel="[true]"
rowLabelOffset="[[0,20]]"
rowItemSpacing="[[0,40]]"
showRowCounter="[false]"
rowItemSize="[[250,273]]"
variableWidthItems="[true]"
translation="[70, 40]" />
</children>
<script type="text/brightscript" uri="pkg:/components/BrowseScreen/BrowseScreen.brs"/>
</component>
customItem.xml
<?xml version="1.0" encoding="utf-8" ?>
<component name="customItem" extends="Group">
<children>
<Group id="itemCard" translation="[10, 10]" scale="[0.90, 0.90]"
scaleRotateCenter="[125.0, 183.0]">
<Poster id="itemPoster"
width="250"
height="375"
failedBitmapUri="pkg:/images/placeholder/iptv_placeholder_2by3_dark.png"
loadingBitmapUri="pkg:/images/placeholder/iptv_placeholder_2by3_dark.png"
loadDisplayMode="scaleToZoom" />
<Group id="itemMetaGroup"
visible="false"
translation="[0, 273]">
<Rectangle id="itemMetaBG"
width="364"
height="102"
color="0x333333" />
<Label id="itemMetaLabel"
width="320"
height="55"
color="0xebebeb"
opacity="1.0"
translation="[20, 20]"
horizAlign="left">
<Font role="font" uri="pkg:/fonts/Roboto-Bold.ttf" size="21" />
</Label>
<Label id="itemMetaData"
width="320"
height="55"
text="{MetaData}"
color="0x959595"
opacity="1.0"
translation="[20, 60]"
horizAlign="left">
<Font role="font" uri="pkg:/fonts/Roboto-Regular.ttf" size="21" />
</Label>
</Group>
</Group>
</children>
<script type="text/brightscript" uri="pkg:/components/Item/customItem.brs" />
<script type="text/brightscript" uri="pkg:/components/Utils/itemType.brs" />
</component>
如果每行有 11 张海报,则显示如下
1 2 3 4 5 6 7 8 9 10 11 1 2 3 4 5 6 7 8 9 10 11 1 2 ...
我无法理解为什么这些项目会重复。谁能告诉我是否有任何方法可以解决此问题。
您的 RowList 之所以如此,是因为其 rowFocusAnimationStyle 设置为 "fixedFocusWrap"。将其更改为 rowFocusAnimationStyle="floatingFocus"
应该可以解决您的问题。
我正在尝试使用包含 3 行的行列表。每行将包含 11 个项目。但是当它显示时,在 11 个项目之后,所有行中的项目再次重复。
下面是 XML 个文件。
BrowseScreen.xml
<?xml version="1.0" encoding="utf-8" ?>
<component name="BrowseScreen" extends="Group">
<children>
<!-- The main content -->
<RowList id="BrowseRowList"
itemComponentName="customItem"
focusXOffset="[0]"
itemSize="[1920,500]"
numRows="3"
drawFocusFeedback="false"
rowFocusAnimationStyle="fixedFocusWrap"
rowHeights="[500]"
showRowLabel="[true]"
rowLabelOffset="[[0,20]]"
rowItemSpacing="[[0,40]]"
showRowCounter="[false]"
rowItemSize="[[250,273]]"
variableWidthItems="[true]"
translation="[70, 40]" />
</children>
<script type="text/brightscript" uri="pkg:/components/BrowseScreen/BrowseScreen.brs"/>
</component>
customItem.xml
<?xml version="1.0" encoding="utf-8" ?>
<component name="customItem" extends="Group">
<children>
<Group id="itemCard" translation="[10, 10]" scale="[0.90, 0.90]"
scaleRotateCenter="[125.0, 183.0]">
<Poster id="itemPoster"
width="250"
height="375"
failedBitmapUri="pkg:/images/placeholder/iptv_placeholder_2by3_dark.png"
loadingBitmapUri="pkg:/images/placeholder/iptv_placeholder_2by3_dark.png"
loadDisplayMode="scaleToZoom" />
<Group id="itemMetaGroup"
visible="false"
translation="[0, 273]">
<Rectangle id="itemMetaBG"
width="364"
height="102"
color="0x333333" />
<Label id="itemMetaLabel"
width="320"
height="55"
color="0xebebeb"
opacity="1.0"
translation="[20, 20]"
horizAlign="left">
<Font role="font" uri="pkg:/fonts/Roboto-Bold.ttf" size="21" />
</Label>
<Label id="itemMetaData"
width="320"
height="55"
text="{MetaData}"
color="0x959595"
opacity="1.0"
translation="[20, 60]"
horizAlign="left">
<Font role="font" uri="pkg:/fonts/Roboto-Regular.ttf" size="21" />
</Label>
</Group>
</Group>
</children>
<script type="text/brightscript" uri="pkg:/components/Item/customItem.brs" />
<script type="text/brightscript" uri="pkg:/components/Utils/itemType.brs" />
</component>
如果每行有 11 张海报,则显示如下
1 2 3 4 5 6 7 8 9 10 11 1 2 3 4 5 6 7 8 9 10 11 1 2 ...
我无法理解为什么这些项目会重复。谁能告诉我是否有任何方法可以解决此问题。
您的 RowList 之所以如此,是因为其 rowFocusAnimationStyle 设置为 "fixedFocusWrap"。将其更改为 rowFocusAnimationStyle="floatingFocus"
应该可以解决您的问题。