Closed StephenCMZ closed 7 years ago
首先你找到SyllabusActivity中 97 98 行 在确保你的View绘制出来之后调用这两句话 最后一个参数 时间 改为0 然后你在你的recyclerView的实例对象使用setNestedScrollingEnabled(false)这个方法 禁止掉嵌套滑动就可以了
感谢!
额,ST同学解决了吗?
@JYPJSY 根据楼上作者的回复,已经解决了
@StephenCMZ 老哥 Utils.scrollTo(content, recyclerView, monthPager.getCellHeight(), 200); calendarAdapter.switchToWeek(0); 这两句代码你些在哪里了。我放在initMonthPager();这个方法后面了。但是变为周的时候显示空白。滑动一下就好了。
@StephenCMZ 请问,初始化就是周历的话。你的周历滑动操作,周历数据不会异常吗??我的周历数据异常了。求教,除了作者回复的修改,你还修改了哪里,谢谢。
@hqAnd 根据作者的回答是“在确保你的View绘制出来之后调用”,放在initMonthPager();后面出现异常,估计是 View 还没绘制完成吧。我是如下调用的:
@Override
public void onStart() {
super.onStart();
if (calendarAdapter.getCalendarType() != CalendarAttr.CalendayType.WEEK){
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
scrollSwitchAction();
}
},500);
}
}
@JYPJSY 确实有出现过周历数据异常,我的做法是延迟切换到周模式:
@Override
public void onStart() {
super.onStart();
if (calendarAdapter.getCalendarType() != CalendarAttr.CalendayType.WEEK){
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
scrollSwitchAction();
}
},500);
}
}
Utils.scrollTo(content, recyclerView, monthPager.getCellHeight(), 0);//时间改为0 calendarAdapter.switchToWeek(monthPager.getRowIndex());//滑动到当前日所在行 这两句方法可以在 @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (hasFocus && !initiated) { refreshMonthPager(); initiated = true; } } 这句生命周期的回调中添加 添加完后可以提pull request ,将这个操作作为日历的一个特性封装起来
@MagicMashRoom 我布局外层没有像你demo那样嵌套,怎么设置,在初始日历的时候只显示week模式?
@MagicMashRoom 只想要你的周日历效果,不需要下面的RecycleView,可以设置吗
问题太多了,基本的需求没办法满足;希望做成通用一点的
@MagicMashRoom 老哥,如何单纯使用月模式呢?