java - 应用程序在多次点击时崩溃 SildingMenu

标签 java android view crash slidingmenu

基本上是用这个库滑动菜单jfeinstein_slidingMenu然后单击按钮发布此代码:

        SlidingMenu menu = new SlidingMenu(this);
        menu.setMode(SlidingMenu.RIGHT);
        menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
        menu.setShadowWidthRes(R.dimen.shadow_width);
        menu.setShadowDrawable(R.drawable.shadow);
        menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
        menu.setFadeDegree(0.35f);
        menu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);
        View imgPanView = getLayoutInflater().inflate(R.layout.dropdown, null);

        menu.setMenu(imgPanView);
        menu.showMenu(true);

这是工作正常的代码,但很多时候你点击和关闭 slidemenu 然后它使应用程序崩溃并使用以下 logcat。 相反,我认为我使用嵌套 View 膨胀布局,所以当我在布局中尝试单个图像时,它会在多次点击时崩溃,所以不是嵌套 View 的问题,但可能是某种不同的 View !!!

逻辑猫

E/.UnCaughtException(23025): 手机型号:HTC One X

E/.UnCaughtException(23025): Android Version: 4.2.2
E/.UnCaughtException(23025): Board: unknown
E/.UnCaughtException(23025): Brand: htc
E/.UnCaughtException(23025): Device: endeavoru
E/.UnCaughtException(23025): Host: abm035
E/.UnCaughtException(23025): ID: JDQ39
E/.UnCaughtException(23025): Model: HTC One X
E/.UnCaughtException(23025): Product: htc_asia_india
E/.UnCaughtException(23025): Type: user
E/.UnCaughtException(23025): Total Internal memory: 2266497024
E/.UnCaughtException(23025): Available Internal memory: 283291648
E/.UnCaughtException(23025): Stack:
E/.UnCaughtException(23025): java.lang.StackOverflowError
E/.UnCaughtException(23025): at android.text.Layout.draw(Layout.java:205)
E/.UnCaughtException(23025): at android.text.BoringLayout.draw(BoringLayout.java:400)
E/.UnCaughtException(23025): at android.widget.TextView.onDraw(TextView.java:5272)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13877)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13761)
E/.UnCaughtException(23025): at android.view.ViewGroup.drawChild(ViewGroup.java:2954)
E/.UnCaughtException(23025): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2815)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13759)
E/.UnCaughtException(23025): at android.view.ViewGroup.drawChild(ViewGroup.java:2954)
E/.UnCaughtException(23025): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2815)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13759)
E/.UnCaughtException(23025): at android.view.ViewGroup.drawChild(ViewGroup.java:2954)
E/.UnCaughtException(23025): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2815)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13759)
E/.UnCaughtException(23025): at android.view.ViewGroup.drawChild(ViewGroup.java:2954)
E/.UnCaughtException(23025): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2815)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13759)
E/.UnCaughtException(23025): at android.view.ViewGroup.drawChild(ViewGroup.java:2954)
E/.UnCaughtException(23025): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2815)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13759)
E/.UnCaughtException(23025): at android.view.ViewGroup.drawChild(ViewGroup.java:2954)
E/.UnCaughtException(23025): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2815)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13880)
E/.UnCaughtException(23025): at android.support.v4.view.ViewPager.draw(ViewPager.java:2171)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13761)
E/.UnCaughtException(23025): at android.view.ViewGroup.drawChild(ViewGroup.java:2954)
E/.UnCaughtException(23025): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2815)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13759)
E/.UnCaughtException(23025): at android.view.ViewGroup.drawChild(ViewGroup.java:2954)
E/.UnCaughtException(23025): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2815)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13759)
E/.UnCaughtException(23025): at android.view.ViewGroup.drawChild(ViewGroup.java:2954)
E/.UnCaughtException(23025): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2815)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13880)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13761)
E/.UnCaughtException(23025): at android.view.ViewGroup.drawChild(ViewGroup.java:2954)
E/.UnCaughtException(23025): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2815)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13880)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13761)
E/.UnCaughtException(23025): at android.view.ViewGroup.drawChild(ViewGroup.java:2954)
E/.UnCaughtException(23025): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2815)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13759)
E/.UnCaughtException(23025): at android.view.ViewGroup.drawChild(ViewGroup.java:2954)
E/.UnCaughtException(23025): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2815)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13880)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13761)
E/.UnCaughtException(23025): at android.view.ViewGroup.drawChild(ViewGroup.java:2954)
E/.UnCaughtException(23025): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2815)
E/.UnCaughtException(23025): at com.jeremyfeinstein.slidingmenu.lib.CustomViewAbove.dispatchDraw(CustomViewAbove.java:827)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13880)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13761)
E/.UnCaughtException(23025): at android.view.ViewGroup.drawChild(ViewGroup.java:2954)
E/.UnCaughtException(23025): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2815)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13880)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13761)
E/.UnCaughtException(23025): at android.view.ViewGroup.drawChild(ViewGroup.java:2954)
E/.UnCaughtException(23025): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2815)
E/.UnCaughtException(23025): at com.jeremyfeinstein.slidingmenu.lib.CustomViewAbove.dispatchDraw(CustomViewAbove.java:827)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13880)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13761)
E/.UnCaughtException(23025): at android.view.ViewGroup.drawChild(ViewGroup.java:2954)
E/.UnCaughtException(23025): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2815)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13880)
E/.UnCaughtException(23025): at android.view.View.draw(View.java:13761)
E/.UnCaughtException(23025): at android.view.ViewGroup.drawChild(ViewGroup.java:2954)
E/.UnCaughtException(23025): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2815)
E/.UnCaughtException(23025): at com.jerem

最佳答案

我建议使用板载 android 组件“SlidingDrawer”。这与您尝试使用的 slider 面板非常相似。而且它的工作效率很高。

访问http://developer.android.com/reference/android/widget/SlidingDrawer.html

关于java - 应用程序在多次点击时崩溃 SildingMenu,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22524728/

相关文章:

java - Android:为什么我不能在新线程中创建处理程序

asp.net-mvc-3 - 我可以阻止共享布局用于错误消息吗?

cocoa - 适用于 Mac OS X 的 MapKit?

ios - 检索 UserDefaults 后刷新 viewdidload 上的 collectionView

java - 用java压缩音乐的 jar ?

java - TIBCO BW 或 Java 中的 WS

java - 使用 Java 处理表单数据

java - Android ImageView - 填充宽度和调整大小以保持纵横比

android - 如何将改造与事件总线配对

java - 导入模块后 list 合并失败