I can not disable a tab in android tabbed activity. The tabbed activity have 3 tabs and I want to disable the tab in the middle.
I tried the following code in my Fragment but the variable middleTabView
is always null!
TabLayout tabhostNew = (TabLayout) getActivity().findViewById(R.id.tabs);
TabLayout.Tab middleTabView = tabhostNew.getTabAt(1).getCustomView();
middleTabView.setEnabled(false); //does not work, because middleTabView is null
The following code should work, but i am not able to get the variable tabwidget
.
tabHost.getTabWidget().getChildTabViewAt(your_index).setEnabled(false);
Can you please help me? Thank you in advance!