我已經通讀了Nativescript ListView文檔並搜索了Google,並且找不到任何方法來突出顯示Listview中當前選定的項目......這甚至有可能嗎?如果是這樣,我該怎麼辦?Angular2/Nativescript:如何突出顯示ListView的選定項目?
我的代碼:
<ListView [items]="activeStockTakes" class="list-group" (itemTap)="selectActiveStockTake($event)">
<template let-activeStockTake="item">
<StackLayout>
<Label class="list-group-item" [text]="activeStockTake.UserCode + ' - ' + activeStockTake.Comment"></Label>
</StackLayout>
</template>
</ListView>
非常感謝我已經放棄在這很久以前!完美的作品:)我在你的代碼中注意到的一件事情是:爲什麼在你設置this.selectedIndex的函數中,你是否首先將i的值複製到變量索引中,而不是僅使用i來設置selectedIndex?再次感謝!!! – user2094257
我的應用程序使用2個變量來處理不同的事情,當我刪除了我的非相關代碼的答案,我忘了拿走其中的一個。很高興我能幫上忙! – user3298333