Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fragment中使用根布局作为View填入时遇到的崩溃情况,及目前的解决方案 #67

Open
zhoulisheng-dodo opened this issue Mar 31, 2020 · 0 comments

Comments

@zhoulisheng-dodo
Copy link

zhoulisheng-dodo commented Mar 31, 2020

问题描述 DrawerConsumer在引用Fragment最外层布局作为View,加入至侧滑的Layout中,贴出来的代码rfq_root_view为Fragment的根布局,然后Fragment页面点击home键或者触发onHidden方法时会报空指针异常

请描述您遇到的问题: 解决方案就是在根布局在套一层布局 将rfq_root_view作为第二层布局然后放入SmartSwipe.wrap()方法中即可解决问题

  • 预期行为:无崩溃现象

  • 实际行为:出现了崩溃现象

出问题的代码

//由于SmartSwipe中有较多的内置SwipeConsumer及较多的属性设置
// 为方便排查,请在这里将您出现问题的代码展示出来
                mDrawerConsumer = SmartSwipe.wrap(rfq_root_view)
                        .addConsumer(DrawerConsumer())
                        .setRightDrawerView(horizontalMenu)
                        .setScrimColor(0x2F000000) //设置遮罩的颜色
                        .setShadowColor(0x80000000.toInt())    //设置边缘的阴影颜色
                        .addToExclusiveGroup(SwipeConsumerExclusiveGroup())

当前使用的SmartSwipe版本号:

implementation 'com.billy.android:smart-swipe:1.1.2'
implementation 'com.billy.android:smart-swipe-support:1.1.0'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant