Cha*_*mar 6 android android-jetpack android-jetpack-compose
您好,我正在尝试异步更新 AdapterList Composable 项目。我把 Image 作为列表项之一。图像数据正在使用协程从服务器下载并使用状态更新值。当我抛出列表项时,出现以下错误
java.lang.IllegalStateException: Asking for measurement result of unmeasured layout modifier
at androidx.ui.core.LayoutNodeWrapper.getMeasureResult(LayoutNodeWrapper.kt:58)
at androidx.ui.core.LayoutNodeWrapper.getMeasuredSize(LayoutNodeWrapper.kt:48)
at androidx.ui.core.Placeable.getWidth(Placeable.kt:40)
at androidx.ui.core.LayoutNode.getWidth(ComponentNodes.kt:841)
at androidx.ui.foundation.ListState.composeAndMeasureNextItem-BTEqjtU(AdapterList.kt:222)
at androidx.ui.foundation.ListState.consumePendingScroll(AdapterList.kt:151)
at androidx.ui.foundation.ListState.access$consumePendingScroll$3(Unknown Source:0)
at androidx.ui.foundation.ListState$ListMeasureBlocks.measure(AdapterList.kt:277)
at androidx.ui.core.InnerPlaceable.performMeasure(InnerPlaceable.kt:43)
at androidx.ui.core.LayoutNodeWrapper.measure(LayoutNodeWrapper.kt:99)
at androidx.ui.core.DelegatingLayoutNodeWrapper.performMeasure(DelegatingLayoutNodeWrapper.kt:79)
at androidx.ui.core.LayerWrapper.performMeasure(LayerWrapper.kt:52)
at androidx.ui.core.LayoutNodeWrapper.measure(LayoutNodeWrapper.kt:99)
at androidx.ui.core.DelegatingLayoutNodeWrapper.performMeasure(DelegatingLayoutNodeWrapper.kt:79)
at androidx.ui.core.LayoutNodeWrapper.measure(LayoutNodeWrapper.kt:99)
at androidx.ui.core.DelegatingLayoutNodeWrapper.performMeasure(DelegatingLayoutNodeWrapper.kt:79)
at androidx.ui.core.LayoutNodeWrapper.measure(LayoutNodeWrapper.kt:99)
at androidx.ui.core.DelegatingLayoutNodeWrapper.performMeasure(DelegatingLayoutNodeWrapper.kt:79)
at androidx.ui.core.LayoutNodeWrapper.measure(LayoutNodeWrapper.kt:99)
at androidx.ui.core.LayoutNode$measure$2.invoke(ComponentNodes.kt:1177)
at androidx.ui.core.LayoutNode$measure$2.invoke(Unknown Source:0)
at androidx.ui.core.ModelObserver.observeReads(ModelObserver.kt:151)
at androidx.ui.core.AndroidComposeView.observeMeasureModelReads(AndroidOwner.kt:487)
at androidx.ui.core.LayoutNode.measure(ComponentNodes.kt:1176)
Run Code Online (Sandbox Code Playgroud)
我自己已经见过几次这种情况,两个列表都下载了您所描述的图像,并且还列出了没有完成任何异步工作的列表,但我不认为这是由我们专门做的任何事情引起的。我的印象是,这只是 Compose 当前状态的一个错误。
话虽这么说,AndroidComposeViewAccessibilityDelegateCompat至少是一个处理此错误的类,并引用一个内部问题跟踪器票证,该票证表明它将在 Android R 中修复,至少对于该实例而言。
} catch (e: IllegalStateException) {
// We may get "Asking for measurement result of unmeasured layout modifier" error.
// TODO(b/153198816): check whether we still get this exception when R is in.
info.setBoundsInScreen(android.graphics.Rect())
}
Run Code Online (Sandbox Code Playgroud)
还有一个即将发生的变化,即处理滚动到屏幕外的作品的dev11更新,我很好奇这会如何影响事情。AdapterList
如果您只是好奇错误在哪里抛出,您可以查看LayoutNodeWrapper._measureResult。
| 归档时间: |
|
| 查看次数: |
452 次 |
| 最近记录: |