我在Android Jetpack Compose中使用AdapterList。在列表中,我有可点击的组件。 当我开始滚动而不松动并退出该AdapterList时,它崩溃了。可能是图书馆问题。
预先感谢。
我正在使用...
//Jetpack Component
implementation 'androidx.ui:ui-framework:0.1.0-dev09'
implementation 'androidx.ui:ui-layout:0.1.0-dev09'
implementation 'androidx.ui:ui-material:0.1.0-dev09'
implementation 'androidx.ui:ui-foundation:0.1.0-dev09'
implementation 'androidx.ui:ui-tooling:0.1.0-dev09'
AdapterList
AdapterList(data = model.seats, modifier = Modifier.weight(1f).fillMaxSize()) { seat ->
ItemSeat(seat)}
ListItem
@Composable
fun ItemSeat(seat: Seat) {
Clickable(onClick = {},
modifier = Modifier.drawBackground(color = colorResource(id = R.color.color_cd3f34))
.fillMaxWidth()) {
Text(text = "Seat ${seat.no}")
}
}
崩溃日志
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.nextorder.pos, PID: 4821
java.lang.IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true
at androidx.ui.core.LayoutNodeWrapper.localToRoot(LayoutNodeWrapper.kt:169)
at androidx.ui.core.LayoutNodeWrapper.localToGlobal(LayoutNodeWrapper.kt:165)
at androidx.ui.core.pointerinput.PointerInputFilter.getPosition$ui_platform_release(PointerInput.kt:100)
at androidx.ui.core.pointerinput.Node.dispatchChanges(HitPathTracker.kt:326)
at androidx.ui.core.pointerinput.Node.dispatchChanges(HitPathTracker.kt:332)
at androidx.ui.core.pointerinput.Node.dispatchChanges(HitPathTracker.kt:332)
at androidx.ui.core.pointerinput.Node.dispatchChanges(HitPathTracker.kt:332)
at androidx.ui.core.pointerinput.Node.dispatchChanges(HitPathTracker.kt:332)
at androidx.ui.core.pointerinput.Node.dispatchChanges(HitPathTracker.kt:332)
at androidx.ui.core.pointerinput.Node.dispatchChanges(HitPathTracker.kt:332)
at androidx.ui.core.pointerinput.Node.dispatchChanges(HitPathTracker.kt:332)
at androidx.ui.core.pointerinput.NodeParent.dispatchChanges(HitPathTracker.kt:194)
at androidx.ui.core.pointerinput.HitPathTracker.dispatchChanges(HitPathTracker.kt:100)
at androidx.ui.core.pointerinput.HitPathTracker.dispatchChanges$default(HitPathTracker.kt:91)
at androidx.ui.core.pointerinput.PointerInputEventProcessor.process(PointerInputEventProcessor.kt:67)
at androidx.ui.core.AndroidComposeView.onTouchEvent(AndroidOwner.kt:648)
at android.view.View.dispatchTouchEvent(View.java:13471)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3216)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2888)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3222)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2904)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:754)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1879)
at android.app.Activity.dispatchTouchEvent(Activity.java:3494)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:712)
at android.view.View.dispatchPointerEvent(View.java:13719)
答案 0 :(得分:2)
从dev15版本开始,az ad app permission admin-consent --id <application-id>
已弃用,而赞成AdapterList
。如果您使用LazyColumnFor,则应该解决您指出的问题。
答案 1 :(得分:1)
这是一个已知问题,已在dev14
(当前版本)中得到解决