当我点击EditText时我的应用程序抛出异常(我不知道原因是什么:EditText或opeden键盘)。我看到它可能是由于使用Resources.getDrawable()引起的,但我不这样做。有人可以帮忙吗?
这是日志:
Parent Activity
UPD
W/Resources: Drawable android:drawable/text_cursor_material has unresolved theme attributes! Consider using Resources.getDrawable(int, Theme) or Context.getDrawable(int).
java.lang.RuntimeException
at android.content.res.Resources.getDrawable(Resources.java:797)
at android.support.v7.widget.ResourcesWrapper.getDrawable(ResourcesWrapper.java:128)
at android.support.v7.widget.TintResources.getDrawable(TintResources.java:45)
at android.widget.Editor$InsertionHandleView.getHotspotX(Editor.java:3772)
at android.widget.Editor$HandleView.updateDrawable(Editor.java:3399)
at android.widget.Editor$HandleView.<init>(Editor.java:3390)
at android.widget.Editor$InsertionHandleView.<init>(Editor.java:3728)
at android.widget.Editor$InsertionPointCursorController.getHandle(Editor.java:4036)
at android.widget.Editor$InsertionPointCursorController.access$200(Editor.java:4000)
at android.widget.Editor.onTouchUpEvent(Editor.java:1621)
at android.widget.TextView.onTouchEvent(TextView.java:8034)
at android.view.View.dispatchTouchEvent(View.java:8476)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2406)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2406)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2406)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2406)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2406)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2406)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2406)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2372)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1719)
at android.app.Activity.dispatchTouchEvent(Activity.java:2791)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2333)
at android.view.View.dispatchPointerEvent(View.java:8671)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4164)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4030)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3580)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3633)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3599)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3716)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3607)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3773)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3580)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3633)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3599)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3607)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3580)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5848)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5822)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5793)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5938)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.Message
UPD 2
我刚刚创建了一个示例项目,但仍然出现错误。我有一个只在<EditText
android:id="@+id/activity_enter_login_field"
android:layout_width="250dp"
android:layout_height="40dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/grey_border"
android:hint="login"
android:inputType="text"
android:maxLines="1"
android:imeOptions="actionNext"
android:padding="8dp"
android:textColor="@color/white"
android:textColorHint="@color/grey"/>
设置布局的活动。
布局:
onCreate
由于我使用的库,可能会出现此问题,因此这里是build.gradle:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:layout_width="100dp"
android:layout_height="100dp"
android:inputType="text"
android:hint="text"/>
</FrameLayout>
编辑3
我还更新了高达23.0.3的构建工具,并支持最高23.3.0的库。 错误仍然存在。