基本上是用这个库滑动菜单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/