在我的一个应用程序中,我已经WebView
实现了从 url 加载一些数据。一切都很完美。
但是,每当我尝试长按并选择应用程序的文本时WebView
,应用程序的文本就会崩溃并引发如下错误:即使我试图从EditText
onLongPress 事件中选择文本,它也会引发错误。
我只是无法理解为什么它会抛出这种错误。
08-05 18:54:13.413: E/AndroidRuntime(29849): FATAL EXCEPTION: main
08-05 18:54:13.413: E/AndroidRuntime(29849): java.lang.IllegalStateException: ActionBarContextView can only be used with android:layout_width="match_parent" (or fill_parent)
08-05 18:54:13.413: E/AndroidRuntime(29849): at com.android.internal.widget.ActionBarContextView.onMeasure(ActionBarContextView.java:397)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.View.measure(View.java:15679)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4936)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1433)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.widget.LinearLayout.measureVertical(LinearLayout.java:720)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.widget.LinearLayout.onMeasure(LinearLayout.java:593)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.View.measure(View.java:15679)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4936)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
08-05 18:54:13.413: E/AndroidRuntime(29849): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2200)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.View.measure(View.java:15679)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4936)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1433)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.widget.LinearLayout.measureVertical(LinearLayout.java:720)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.widget.LinearLayout.onMeasure(LinearLayout.java:593)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.View.measure(View.java:15679)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4936)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
08-05 18:54:13.413: E/AndroidRuntime(29849): at com.ovte.slidemenu.widget.Phone_AnimationLayout.onMeasure(Phone_AnimationLayout.java:87)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.View.measure(View.java:15679)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4936)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1433)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.widget.LinearLayout.measureVertical(LinearLayout.java:720)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.widget.LinearLayout.onMeasure(LinearLayout.java:593)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.View.measure(View.java:15679)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4936)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.View.measure(View.java:15679)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4936)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1433)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.widget.LinearLayout.measureVertical(LinearLayout.java:720)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.widget.LinearLayout.onMeasure(LinearLayout.java:593)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.View.measure(View.java:15679)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4936)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
08-05 18:54:13.413: E/AndroidRuntime(29849): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2200)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.View.measure(View.java:15679)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2214)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1298)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1492)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1188)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4986)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:776)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.Choreographer.doCallbacks(Choreographer.java:579)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.Choreographer.doFrame(Choreographer.java:548)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:762)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.os.Handler.handleCallback(Handler.java:725)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.os.Handler.dispatchMessage(Handler.java:92)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.os.Looper.loop(Looper.java:153)
08-05 18:54:13.413: E/AndroidRuntime(29849): at android.app.ActivityThread.main(ActivityThread.java:5316)
08-05 18:54:13.413: E/AndroidRuntime(29849): at java.lang.reflect.Method.invokeNative(Native Method)
08-05 18:54:13.413: E/AndroidRuntime(29849): at java.lang.reflect.Method.invoke(Method.java:511)
08-05 18:54:13.413: E/AndroidRuntime(29849): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
08-05 18:54:13.413: E/AndroidRuntime(29849): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
08-05 18:54:13.413: E/AndroidRuntime(29849): at dalvik.system.NativeStart.main(Native Method)
我已经尝试过以下网站的建议:
http://code.google.com/p/android/issues/detail?id=19021
如何避免 IllegalStateException:旧应用程序中的 ActionBarContextView
如何避免 IllegalStateException:旧应用程序中的 ActionBarContextView
任何人都可以给我这个错误的解决方案。
谢谢你。