Yalantis /Side-Menu.Android 使用报错解决记录
一、引入library时报错
解决:library\build.gradle中apply只保留
apply plugin:'com.android.library'
二、使用logcat查看闪退原因Didn't find class"io.codetail.widget.RevealFrameLayout" on path:··· ···
解决:
方法一:注释掉两个xml文件中RevealFrameLayout的部分,相应部分换成FrameLayout
方法二:在app\build.gradle中加上
repositories {
maven {
url "https://jitpack.io"
}
}
在
app\build.gradle的dependencies中加上
compile 'com.github.ozodrukh:CircularReveal:1.0.4'
三、不想让界面显示Fragment的内容,而是显示自己设置的内容
解决:
1.注释掉Fragment的replace方法
getSupportFragmentManager().beginTransaction()
// .replace(R.id.content_frame, contentFragment)
.commit();
2.删掉replaceFragment方法
//private ScreenShotable replaceFragment(ScreenShotable screenShotable,int topPosition) { ··· }
3.将onSwitch方法中的return replaceFragment(...)改为return ScreenShotable
@Override
public ScreenShotableonSwitch(Resourceble slideMenuItem, ScreenShotable screenShotable, intposition) {
switch(slideMenuItem.getName()) {
caseContentFragment.CLOSE:
returnscreenShotable;
default:
Toast.makeText(this,slideMenuItem.getName(),Toast.LENGTH_SHORT).show();
// returnreplaceFragment(screenShotable, position);
returnscreenShotable;
}
}
4.将Fragment的Java文件中takeScreenShot方法中的内容全部注释
@Override
public void takeScreenShot() {
// Thread thread = newThread() {
// @Override
// public void run() {
// Bitmap bitmap =Bitmap.createBitmap(containerView.getWidth(),
// containerView.getHeight(),Bitmap.Config.ARGB_8888);
// Canvas canvas =new Canvas(bitmap);
// containerView.draw(canvas);
// ContentFragment.this.bitmap = bitmap;
// }
// };
//
// thread.start();
}