Android中ScrollView的IllegalStateException

时间:2019-03-19 08:52:30

标签: java android android-fragments scrollview illegalstateexception

我一直在从我的应用程序中获取这些崩溃报告,但是无论如何我都看不到自己重新创建错误。我确保所有ScrollView都只有1个孩子。

这是我的堆栈跟踪:

at android.widget.ScrollView.addView (ScrollView.java:273)
  at android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManager.java:1425)
  at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState (FragmentManager.java:1750)
  at android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManager.java:1819)
  at android.support.v4.app.BackStackRecord.executePopOps (BackStackRecord.java:855)
  at android.support.v4.app.FragmentManagerImpl.executeOps (FragmentManager.java:2587)
  at android.support.v4.app.FragmentManagerImpl.executeOpsTogether (FragmentManager.java:2377)
  at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute (FragmentManager.java:2332)
  at android.support.v4.app.FragmentManagerImpl.popBackStackImmediate (FragmentManager.java:851)
  at android.support.v4.app.FragmentManagerImpl.popBackStackImmediate (FragmentManager.java:794)
  at android.support.v4.app.FragmentActivity.onBackPressed (FragmentActivity.java:181)
  at android.app.Activity.onKeyUp (Activity.java:2999)
  at android.view.KeyEvent.dispatch (KeyEvent.java:2715)
  at android.app.Activity.dispatchKeyEvent (Activity.java:3291)
  at android.support.v7.app.AppCompatActivity.dispatchKeyEvent (AppCompatActivity.java:534)
  at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent (WindowCallbackWrapper.java:58)
  at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent (AppCompatDelegateImplBase.java:316)
  at com.android.internal.policy.DecorView.dispatchKeyEvent (DecorView.java:374)
  at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent (ViewRootImpl.java:5170)
  at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess (ViewRootImpl.java:5042)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4363)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4416)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4382)
  at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:4390)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4363)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4416)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4382)
  at android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:4525)
  at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:4390)
  at android.view.ViewRootImpl$AsyncInputStage.apply (ViewRootImpl.java:4582)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4363)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4416)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4382)
  at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:4390)
  at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4363)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4416)
  at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4382)
  at android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:4558)
  at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent (ViewRootImpl.java:4719)
  at android.view.inputmethod.InputMethodManager$PendingEvent.run (InputMethodManager.java:2459)
  at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback (InputMethodManager.java:2022)
  at android.view.inputmethod.InputMethodManager.finishedInputEvent (InputMethodManager.java:2013)
  at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished (InputMethodManager.java:2436)
  at android.view.InputEventSender.dispatchInputEventFinished (InputEventSender.java:141)
  at android.os.MessageQueue.nativePollOnce (Native Method)
  at android.os.MessageQueue.next (MessageQueue.java:325)
  at android.os.Looper.loop (Looper.java:142)
  at android.app.ActivityThread.main (ActivityThread.java:6651)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:438)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:810)

以下是可能发生的一些潜在地方:

  1. 我正在使用FragmentTransaction(支持),使用常规布局/片段(而不是FrameLayout)替换ScrollView视图,以使布局可滚动。但是ScrollView继承了FrameLayout。

  2. 我在多个活动/片段中重复使用同一对话框,并根据选择的枚举/状态更改内容。

  3. 我允许在对话框上更改配置。

这3个都不会在模拟器或手机上对我造成错误,但它是在实时应用程序中执行的。任何帮助将不胜感激。

0 个答案:

没有答案