I am not sure if I understand your question correctly, but I think this is what you are looking for:
How to implement a ViewPager with different Fragments / Layouts
The basic idea is that you have a different Fragment class for each different layout you have. In this case, all Fragments have a TextView, but their layouts also differ in a separate background color.