App Crash SildingMenu On Many Clicks

时间:2014-03-20 06:06:23

标签: 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。 相反,我认为我使用嵌套视图膨胀布局,所以当我在布局中尝试单个图像时,它会在很多点击时崩溃,所以不是嵌套视图的问题,但不知何故可能是不同的一个!!!

Logcat

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

1 个答案:

答案 0 :(得分:0)

我建议使用板载Android组件' SlidingDrawer '。这与您尝试使用的滑块面板非常相似。而且效果非常好。

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