Comments (8)
我也遇到这个问题,希望楼主找找原因,拜托了
from flycotablayout.
空指针一般都是生命周期的问题,fragment里可以放在onviewcreate初始化
from flycotablayout.
我也遇到这个问题,我的是fragment 里面通过SegmentTabLayout嵌套3个fragment,在第三个fragment里面点击一个按钮跳到另外一个activity 返回到 SegmentTabLayout 的第三个fragment 滑动报这个错误
from flycotablayout.
第一遍就没报,,敲第二遍就报
from flycotablayout.
我也遇到这个问题 请问各位怎么解决的
from flycotablayout.
You need to do a check:
private List<Fragment> tabs = new ArrayList<>();
private PagerAdapter pagerAdapter;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment, container, false);
initTabs();
return view;
}
private void initTabs() {
if (pagerAdapter == null) {
pagerAdapter = new PagerAdapter(getChildFragmentManager());
}
if (tabs.isEmpty()) {
tabs.add(FirstFragment.newInstance());
tabs.add(SecondFragment.newInstance());
}
viewPager.setAdapter(pagerAdapter);
tabLayout.setTabData(titles);
tabLayout.setOnTabSelectListener(position -> viewPager.setCurrentItem(position));
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
tabLayout.setCurrentTab(position);
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
}
from flycotablayout.
最后怎么解决的。。。
from flycotablayout.
mIndicatorAnimEnable为true时会执行calcOffset()方法,可以尝试设置mIndicatorAnimEnable为false绕过该方法。可以解决问题。但是希望有更好的方法解决
from flycotablayout.
Related Issues (20)
- SegmentTabLayout不显示右角标数字
- 怎么设置下滑线用自己的图片来设置啊? HOT 1
- CommonTabLayout
- 怎么设置纵向滑动
- SlidingTabLayout设置红点 默认显示在左边 HOT 2
- SlidingTabLayout.setOnTabSelectListener错误 只有点击事件 没有滚动事件
- SlidingTabLayout配合ViewPager使用 viewpage不能自适应吗? 如果不设置高度 就会不显示
- TAB选中项加粗状态有缺陷 HOT 3
- app:tl_textBold="SELECT"的情况下,默认选中的第一项未加粗 HOT 4
- 一点建议
- 和Navigation搭配 rootFragment内放改控件,会导致内容不显示的问题 HOT 1
- tl_textBold无效 HOT 3
- 各位大佬,问下如何支持RTL布局? 翻转的话,就不显示TAB文字了。 HOT 2
- set Font Family for the tap title
- 平板横屏时不能平均铺满屏幕
- SlidingTabLayout不支持Viewpager2 HOT 7
- 滑动字体大小渐变
- 设置了setSnapOnTabClick(true)后tab的字体选中大小以及指示器不工作了
- 支持viewpage2
- Fragment 中无法使用建议:SlidingTabLayout setViewPager 参数 FragmentActivity 换成 FragmentManager
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flycotablayout.