【问题标题】:requestLayout() improperly called by md5f92e0daf340890c9667469657ee2ece8.LabelRendererrequestLayout() 被 md5f92e0daf340890c9667469657ee2ece8.LabelRenderer 错误调用
【发布时间】:2020-01-06 19:37:37
【问题描述】:

我使用 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

【问题讨论】:

  • 你在使用 Nuget DLToolkit.Forms.Controls.FlowListView 吗?
  • 是的,我使用过 DLToolkit.Forms.Controls.FlowListView 但 FlowListView 没有任何问题,问题出在 Lable FormatedString 我找到了解决方案。
  • 恭喜。编码快乐... :)

标签: xamarin.forms xamarin.android


【解决方案1】:

返回 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); }
        }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多