我已经使用FlowListView进行无限加载,但是在向上和向下滚动项目时会不断获取日志,因此这会使我的应用程序性能下降,并有时使应用程序冻结。这仅是android的问题,在iOS中工作正常。
使用的包裹
Xamarin.Forms(4.3.0.991211)
Prism.Unity.Forms(7.1.0.431)
在“应用程序输出”窗口中获取此日志:
[View] requestLayout() improperly called by md58432a647068b097f9637064b8985a5e0.NavigationPageRenderer{b88481c V.E...... ......I. 0,0-1080,1731 #f3} during second layout pass: posting in next frame
[View] requestLayout() improperly called by md5f92e0daf340890c9667469657ee2ece8.LabelRenderer{d3b3835 V.ED..... ......I. 0,58-739,125 #3bb} during second layout pass: posting in next frame
[View] requestLayout() improperly called by md5f92e0daf340890c9667469657ee2ece8.LabelRenderer{f7422b1 V.ED..... ......I. 0,141-739,173 #3bc} during second layout pass: posting in next frame
[View] requestLayout() improperly called by md5f92e0daf340890c9667469657ee2ece8.LabelRenderer{880b599 V.ED..... ......I. 0,58-739,90 #3c6} during second layout pass: posting in next frame
[View] requestLayout() improperly called by md5f92e0daf340890c9667469657ee2ece8.LabelRenderer{ffa7ed1 V.ED..... ......I. 0,106-739,138 #3c7} during second layout pass: posting in next frame
[View] requestLayout() improperly called by md5f92e0daf340890c9667469657ee2ece8.LabelRenderer{d35a195 V.ED..... ......ID 0,58-739,90 #3b0} during layout: running second layout pass
[View] requestLayout() improperly called by md5f92e0daf340890c9667469657ee2ece8.LabelRenderer{1696e4d V.ED..... ......ID 0,106-739,138 #3b1} during layout: running second layout pass
[View] requestLayout() improperly called by md58432a647068b097f9637064b8985a5e0.NavigationPageRenderer{b88481c V.E...... ........ 0,0-1080,1731 #f3} during second layout pass: posting in next frame
[View] requestLayout() improperly called by md5f92e0daf340890c9667469657ee2ece8.LabelRenderer{d3b3835 V.ED..... ........ 0,58-739,125 #3bb} during second layout pass: posting in next frame
[View] requestLayout() improperly called by md5f92e0daf340890c9667469657ee2ece8.LabelRenderer{f7422b1 V.ED..... ........ 0,141-739,173 #3bc} during second layout pass: posting in next frame
[View] requestLayout() improperly called by md5f92e0daf340890c9667469657ee2ece8.LabelRenderer{880b599 V.ED..... ........ 0,58-739,90 #3c6} during second layout pass: posting in next frame
[View] requestLayout() improperly called by md5f92e0daf340890c9667469657ee2ece8.LabelRenderer{ffa7ed1 V.ED..... ........ 0,106-739,138 #3c7} during second layout pass: posting in next frame
[View] requestLayout() improperly called by md5f92e0daf340890c9667469657ee2ece8.LabelRenderer{d35a195 V.ED..... ......ID 0,58-739,90 #3b0} during layout: running second layout pass
[View] requestLayout() improperly called by md5f92e0daf340890c9667469657ee2ece8.LabelRenderer{1696e4d V.ED..... ......ID 0,106-739,138 #3b1} during layout: running second layout pass
[View] requestLayout() improperly called by md58432a647068b097f9637064b8985a5e0.NavigationPageRenderer{b88481c V.E...... ........ 0,0-1080,1731 #f3} during second layout pass: posting in next frame
[View] requestLayout() improperly called by md5f92e0daf340890c9667469657ee2ece8.LabelRenderer{d3b3835 V.ED..... ........ 0,58-739,125 #3bb} during second layout pass: posting in next frame
[View] requestLayout() improperly called by md5f92e0daf340890c9667469657ee2ece8.LabelRenderer{f7422b1 V.ED..... ........ 0,141-739,173 #3bc} during second layout pass: posting in next frame
[View] requestLayout() improperly called by md5f92e0daf340890c9667469657ee2ece8.LabelRenderer{880b599 V.ED..... ........ 0,58-739,90 #3c6} during second layout pass: posting in next frame
[View] requestLayout() improperly called by md5f92e0daf340890c9667469657ee2ece8.LabelRenderer{ffa7ed1 V.ED..... ........ 0,106-739,138 #3c7} during second layout pass: posting in next frame
[zygote] Explicit concurrent copying GC freed 2553(147KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 3MB/6MB, paused 13us total 10.190ms
[monodroid-gc] GC cleanup summary: 210 objects tested - resurrecting 58.
[Mono] GC_TAR_BRIDGE bridges 210 objects 1656381 opaque 705837 colors 210 colors-bridged 210 colors-visible 210 xref 0 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.02ms tarjan 199.42ms scc-setup 0.03ms gather-xref 0.00ms xref-setup 0.00ms cleanup 10.56ms
[Mono] GC_BRIDGE: Complete, was running for 23.75ms
[Mono] GC_MINOR: (Nursery full) time 224.80ms, stw 225.72ms promoted 1127K major size: 104272K in use: 100506K los size: 11264K in use: 3302K
返回FormattedString的新对象,它解决了我的问题。
private FormattedString _VoteDescription;
public FormattedString VoteDescription {
get {
var tempVoteDescription = new FormattedString();
if (_VoteDescription != null) {
foreach (var span in _VoteDescription.Spans) {
tempVoteDescription.Spans.Add(new Span() {
BackgroundColor = span.BackgroundColor,
TextColor = span.TextColor,
Text = span.Text,
Style = span.Style,
TextDecorations = span.TextDecorations,
BindingContext = span.BindingContext,
FontAttributes = span.FontAttributes,
FontFamily = span.FontFamily,
FontSize = span.FontSize,
LineHeight = span.LineHeight
});
}
}
return tempVoteDescription;
//return _VoteDescription;
}
set { SetProperty(ref _VoteDescription, value); }
}