当我在我的设备中使用 showviewview 时,不会发生错误。但是当在模拟器崩溃中运行应用程序时。展示视图正常工作,直到想要隐藏()它。这是我的代码:
ShowcaseView showcaseView = new ShowcaseView.Builder(MainActivity.this)
.setContentText("")
.setContentTitle("")
.setTarget(new ViewTarget(fab)).setOnClickListener(mOnClickListener)
.build();
和 showCaseButton 的侦听器:
View.OnClickListener mOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
showcaseView.hide();
}
};
这是我的日志:
java.lang.NullPointerException
at com.github.amlcurran.showcaseview.StandardShowcaseDrawer.erase(StandardShowcaseDrawer.java:75)
at com.github.amlcurran.showcaseview.ShowcaseView.dispatchDraw(ShowcaseView.java:246)
at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.draw(View.java:10981)
at android.widget.FrameLayout.draw(FrameLayout.java:450)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2126)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2026)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1634)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)