2016-02-11 68 views
0

這是我的XML。在EditText之後寫點東西,然後點擊它有異常。我也在仿真器API21和真實設備API19上進行了測試。我無法在堆棧跟蹤例外中找到我的軟件包。Edittext中的Android getDrawable異常

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:divider="?android:dividerHorizontal" 
    android:showDividers="middle" 
    android:theme="@style/BlackTextViewStyle" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin"> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:text="@string/contactText" 
     android:paddingBottom="@dimen/activity_vertical_margin"/> 

    <EditText 
     android:id="@+id/contactForm" 
     android:layout_width="fill_parent" 
     android:layout_height="0dip" 
     android:inputType="textMultiLine" 
     android:layout_weight="1" 
     android:lines="10" 
     android:gravity="top|start" 
     android:scrollbars="vertical" 
     android:imeOptions="actionSend"> 
     <requestFocus/> 
    </EditText> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:gravity="center_vertical" 
     style="?android:buttonBarStyle"> 

     <Button 
      android:id="@+id/sendContactsButton" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="@string/send" 
      android:textSize="@dimen/main_button" 
      style="?android:attr/buttonBarButtonStyle" 
      android:textStyle="bold"/> 

    </LinearLayout> 
</LinearLayout> 

,這是例外

02-11 14:31:23.880 19023-19648/? E/AndroidRuntime﹕ FATAL EXCEPTION: main 
    Process: com.opentaxi.android, PID: 19023 
    android.content.res.Resources$NotFoundException: Resource ID #0x0 
      at android.content.res.Resources.getValue(Resources.java:1233) 
      at android.content.res.Resources.getDrawable(Resources.java:756) 
      at android.support.v7.widget.bb.getDrawable(ResourcesWrapper.java:133) 
      at android.content.Context.getDrawable(Context.java:402) 
      at android.widget.Editor$InsertionPointCursorController.getHandle(Editor.java:3797) 
      at android.widget.Editor$InsertionPointCursorController.show(Editor.java:3776) 
      at android.widget.Editor.onTouchUpEvent(Editor.java:1632) 
      at android.widget.TextView.onTouchEvent(TextView.java:7995) 
      at android.view.View.dispatchTouchEvent(View.java:8388) 
      at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430) 
      at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172) 
      at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430) 
      at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172) 
      at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430) 
      at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172) 
      at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430) 
      at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172) 
      at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430) 
      at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172) 
      at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430) 
      at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172) 
      at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430) 
      at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172) 
      at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430) 
      at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172) 
      at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430) 
      at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172) 
      at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2314) 
      at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1692) 
      at android.app.Activity.dispatchTouchEvent(Activity.java:2739) 
      at android.support.v7.view.m.dispatchTouchEvent(WindowCallbackWrapper.java:60) 
      at android.support.v7.view.m.dispatchTouchEvent(WindowCallbackWrapper.java:60) 
      at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2275) 
      at android.view.View.dispatchPointerEvent(View.java:8578) 
      at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4021) 
      at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3887) 
      at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3449) 
      at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3502) 
      at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3468) 
      at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3578) 
      at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3476) 
      at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3635) 
      at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3449) 
      at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3502) 
      at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3468) 
      at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3476) 
      at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3449) 
      at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5701) 
      at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5675) 
      at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5646) 
      at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5791) 
      at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185) 
      at android.os.MessageQueue.nativePo 
+0

你可以發佈代碼執行點擊? –

+0

我沒有點擊EditText代碼。它只有點擊事件sendContactsButton @Click void sendContactsButton() - >我使用AA框架。但是,如果我在EditText字段中單擊EditText後點擊EditText,則會出現異常 – sytolk

+0

單擊sendContactsButton按鈕可以工作。單擊EditText而不寫一些字母不會導致Exeption。只有我寫了一些東西,然後點擊按鈕上的EditText,纔會出現問題。 – sytolk

回答

0

它在LinearLayout中有android:theme="@style/BlackTextViewStyle"刪除的主題後,並添加顏色現在的TextView其作品。但有了這個主題不起作用:

<style name="BlackTextViewStyle" parent="android:Widget.TextView"> 
     <item name="android:textColor">@color/black_color</item> 
     <item name="android:textStyle">bold</item> 
</style>