AppCompat的SearchView在KitKat上导致NullPointerException

时间:2017-12-08 14:31:24

标签: android nullpointerexception android-canvas android-appcompat searchview

我在app中使用AppCompat的SearchView。在运行Android KitKat(4.4.4)的Samsung Galaxy Tab 3 Lite上运行应用程序时,我得到了各种NullPointerException

  • 调用setIconified(true)时,我收到以下异常:

    12-08 14:58:31.124 15344-15344/com.algolia.instantsearch.examples.ecommerce E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.algolia.instantsearch.examples.ecommerce, PID: 15344
    java.lang.NullPointerException 
        at android.graphics.Canvas.drawLine(Canvas.java:931)
        at android.graphics.drawable.GradientDrawable.draw(GradientDrawable.java:538)
        at android.view.View.draw(View.java:14666)
        at android.view.View.draw(View.java:14566)
        ...
    
  • 同样,只需打开该应用并点按SearchView即可展开该应用,结果如下:

    12-08 14:58:31.124 15344-15344/com.algolia.instantsearch.examples.ecommerce E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.algolia.instantsearch.examples.ecommerce, PID: 15344
    java.lang.NullPointerException 
        at android.graphics.Canvas.drawLine(Canvas.java:931)
        at android.graphics.drawable.GradientDrawable.draw(GradientDrawable.java:538)
        at android.view.View.draw(View.java:14666)
        at android.view.View.draw(View.java:14566)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3237)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3074)
        at android.view.View.draw(View.java:14564)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3237)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3074)
        at android.view.View.draw(View.java:14564)
        at android.view.ViewGroup.drawChild(ViewGroup.java:3237)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3074)
        at android.view.View.draw(View.java:14684)
        at android.view.View.draw(View.java:14566)
    

这是预期的吗?我在网上找不到任何关于此问题的报告。

我是否会错过在Android 4.4.4上使用AppCompat的SearchView的内容?

0 个答案:

没有答案