Comments (3)
Hi, @GabiR
Sorry for replying late.
Maybe it will work with this code.
onCreate:
FragmentPagerItems pages = FragmentPagerItems.with(this)
.add("Test1", Fragment1.class)
.add("Test2", Fragment2.class)
.add("Test3", Fragment3.class)
.create();
FragmentStatePagerItemAdapter adapter = new FragmentStatePagerItemAdapter(
getSupportFragmentManager(), pages) {
@Override
public int getItemPosition(Object object) {
return PagerAdapter.POSITION_NONE;
}
};
viewPager.setAdapter(adapter);
viewPagerTab.setViewPager(viewPager);
Replace:
pages.set(1, FragmentPagerItem.of("Test2", Fragment4.class));
adapter.notifyDataSetChanged();
If you want to also change the tab name, you will need to re-set the SmartTabLayout#setViewPager(...)
pages.set(1, FragmentPagerItem.of("Test2", Fragment4.class));
adapter.notifyDataSetChanged();
viewPagerTab.setViewPager(viewPager);
Solved?
from smarttablayout.
Yup, thanks a lot
from smarttablayout.
@ogaclejapan would you be able to provide a working example of this? Trying to implement something similar and it changes the text within the tab but doesn't change the fragment displayed.
Update:
I tried adding the fragment within a new tab, seems like the issue is only for updating an existing tab.
from smarttablayout.
Related Issues (20)
- PagerAdapter for View-based Page
- java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
- Its not working with ViewPager2? HOT 7
- Selected Text Color
- custom integration
- How to change tab text color dynamically from coding end.
- Background Color is not 100 percent white !!!
- how to set indicator's width to the textview's width
- Changing stl_defaultTabTextSize programmatically
- Nested Tabs
- Only works for 2 tabs. the 3rd tab does not render content HOT 1
- Me HOT 1
- H
- how to unselect all tab?
- Viewpager2 not supported
- How Do I disable scrolling right and left.
- 指示线跟文字根本不匹配 HOT 1
- Doesn't inherit font style from theme an style xml file
- How to get Indicator Thickness Trick 1 style for the tab buttons. HOT 1
- How do I set up icons instead of letters?
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 smarttablayout.