当我在平板电脑中第二次触摸edittext时应用程序崩溃

时间:2016-10-03 06:40:42

标签: android android-layout android-fragments android-edittext

当我在7&amp ;;中第二次触摸edittext时,我的应用程序一直崩溃10英寸设备。相同的应用程序在移动设备中运行良好。我正在为景观导向开发应用程序。 这是我的日志

 FATAL EXCEPTION: main
 Process: com.android.TabletApp, PID: 15773
 android.content.res.Resources$NotFoundException: Resource ID #0x0
 at android.content.res.Resources.getValue(Resources.java:1251)
 at android.content.res.Resources.getDrawable(Resources.java:758)
 at android.widget.Editor$InsertionPointCursorController.getHandle(Editor.java:3621)
 at android.widget.Editor$InsertionPointCursorController.show(Editor.java:3600)
 at android.widget.Editor.onTouchUpEvent(Editor.java:1658)
 at android.widget.TextView.onTouchEvent(TextView.java:7957)
 at android.view.View.dispatchTouchEvent(View.java:7789)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2326)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2031)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2326)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2031)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2326)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2031)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2326)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2031)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2326)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2031)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2326)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2031)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2326)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2031)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2326)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2031)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2326)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2031)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2326)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2031)
 at  com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2133)
 at  com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1557)
 at android.app.Activity.dispatchTouchEvent(Activity.java:2491)
 at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneW indow.java:2081)
 at android.view.View.dispatchPointerEvent(View.java:7980)
 at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4392)
 at  android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4263)
 at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3809)
 at  android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3859)
 at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3828)
 at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3935)
 at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3836)
 at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3992)
 at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3809)
 at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3859)
 at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3828)
 at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3836)
 at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3809)
 at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6124)
 at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6104)
 at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6058)
 at  android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6254)
 at   android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
 at android.os.MessageQueue.nativePollOnce(Native Method)
 at android.os.MessageQueue.next(MessageQueue.java:138)

我正在使用简单的edittext。适用于移动设备,不适用于平板电脑。整个应用程序处于横向方向。

1 个答案:

答案 0 :(得分:0)

确保您已创建以下drawable:

// for Phones
drawable-ldpi
drawable-mdpi
drawable-hdpi

//for 7 inch tablets
drawable-large-mdpi
drawable-large-hdpi(for Nexus 7)

// for 10 inch tablets
drawable-xlarge-mdpi

并在每个中加上 square_background