gpt4 book ai didi

java - 在 appcompat-v7 :23. 0.0 中 Snackbar 触摸或滑动时出现 NullPointerException

转载 作者:行者123 更新时间:2023-11-30 01:56:06 25 4
gpt4 key购买 nike

我在滑动Snackbar的时候发现了一个错误,像这个代码https://github.com/nuuneoi/Lab-Android-DesignLibrary .

1.使用 appcompat-v7:23.0.0 在适当的上下文中将此代码添加到应用中:

Snackbar
.make(rootLayout, R.string.snackbar_text, Snackbar.LENGTH_LONG)
.show();

2.该 View 必须在 AppBarLayout 中有一个工具栏,如下所示:

<android.support.design.widget.CoordinatorLayout
android:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" />

</android.support.design.widget.AppBarLayout>

</android.support.design.widget.CoordinatorLayout>

3.在手机上滑动 Snackbar。

4.应用崩溃

java.lang.NullPointerException
at android.support.design.widget.AppBarLayout$Behavior.onInterceptTouchEvent(AppBarLayout.java:729)
at android.support.design.widget.AppBarLayout$Behavior.onInterceptTouchEvent(AppBarLayout.java:629)
at android.support.design.widget.CoordinatorLayout.performIntercept(CoordinatorLayout.java:357)
at android.support.design.widget.CoordinatorLayout.onInterceptTouchEvent(CoordinatorLayout.java:409)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1859)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2086)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1533)
at android.app.Activity.dispatchTouchEvent(Activity.java:2458)
at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)

最佳答案

问题已解决,已在 23.0.1 版本中修复。支持库

关于java - 在 appcompat-v7 :23. 0.0 中 Snackbar 触摸或滑动时出现 NullPointerException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32185369/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com