I updated the design support library from version 22.2.0 to 22.2.1 yesterday and I'm facing a strange behaviour with TabLayout
.
On version 22.2.0, the TabLayout worked just fine, but now it doesn't show up in my frag unless I rotate my phone (then it appears).
I haven't changed my code, it just stopped working.
Here are the snippets:
public class FriendFragment extends Fragment {
@Bind(R.id.friendPager)
ViewPager viewPager;
@Bind(R.id.friendSlideTab)
TabLayout tabLayout;
...
@Override
public void onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_friend,container,false);
ButterKnife.bind(this,v);
return v;
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
list.add(new SlideFragment(getString(R.string.my_friends), new MyFriendsFragment()));
list.add(new SlideFragment(getString(R.string.add_friend), new SearchFriendFragment()));
adapter = new FragmentSliderAdapter(list, getChildFragmentManager());
viewPager.setAdapter(adapter);
tabLayout.setupWithViewPager(viewPager);
}
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<android.support.design.widget.TabLayout
android:id="@+id/friendSlideTab"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.design.widget.TabLayout>
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/friendPager"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1" />
</LinearLayout>
I use ButterKnife, don't think it would make any difference since in the previous version it was working with it.
Thanks and any help would be appreciated !
com.android.support:design
, or all ofcom.android.support
? – Flyleafcom.android.support:appcompat
,com.android.support:support-v4
,com.android.support:recyclerview-v7
,com.android.support:design
, all to 22.2.1. Thanks – Inducement