android-tabs
How is TabItem used when placed in the layout XML?
This appears to be a relatively recent addition to the design library, apparently added in version 23.2.0, though it’s not mentioned in the revision history. It’s functionality is pretty basic, and the only attributes it seems to use are the three given in its docs: text, icon, and layout. From testing, it seems it’s basically … Read more
Adding Tab inside Fragment In Android?
Try to do this to handle the Tabs: public class MainFragment extends Fragment { private FragmentTabHost mTabHost; //Mandatory Constructor public MainFragment() { } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_tabs,container, false); mTabHost = (FragmentTabHost)rootView.findViewById(android.R.id.tabhost); mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.realtabcontent); mTabHost.addTab(mTabHost.newTabSpec(“fragmentb”).setIndicator(“Fragment B”), FragmentB.class, null); mTabHost.addTab(mTabHost.newTabSpec(“fragmentc”).setIndicator(“Fragment … Read more
Fragment view in ViewPager is not restored when resuming
After a while ran into the same problem again, so updating this question. If you’re using FragmentStatePagerAdapter you should provide FragmentManager via getChildFragmentManager() instead of getFragmentManager(). See Issue 55068: ViewPager doesn’t refresh child fragments when back navigation via backstack
Set Default Tab for Fragment/ViewPager setup
Have you tried calling mViewPager.setCurrentItem(tab.getPosition()); at the end of onCreate()?
How to style the divider between Ice Cream Sandwich tabs?
After removing every style I use I got the following image: This image also contains the small gaps. Therefore it seems that this is some kind of default behavior. However I found a way to work around the problem. I set the redline as a standard Background for the whole tabbar. This way the gap … Read more
android 5.0 material design tabs [closed]
This post of @ChrisBanes (Developer Programs Engineer for Android) explain the situation with the new Toolbar. So this sample can help. As well as this DevBytes video. If you want a library, you can go for this one but It is not updated to material design (I forked it, and If I have some time, … Read more
Disable swiping between tabs
This answer can be applied to any ViewPager actually no matter what is the library you are using to implement the tabs or even a normal ViewPager without tabs. The library you are using neokree/MaterialTabs is backed with a ViewPager that is responsible for the swiping effect and you can disable that by using the … Read more
TabWidget current tab bottom line color
The color of the tab indicator is being set by a selector drawable which can be found here and looks like this: <!– AOSP copyright notice can be found at the above link –> <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <!– Non focused states –> <item android:state_focused=”false” android:state_selected=”false” android:state_pressed=”false” android:drawable=”@drawable/tab_unselected_holo” /> <item android:state_focused=”false” android:state_selected=”true” android:state_pressed=”false” android:drawable=”@drawable/tab_selected_holo” /> <!– Focused … Read more