Zaktualizowałem bibliotekę wsparcia projektu z wersji 22.2.0 na 22.2.1 wczoraj i mam dziwne zachowanie z TabLayout
. W wersji 22.2.0 TabLayout działał dobrze, ale teraz nie pojawia się w moim fragie, chyba że obrócę telefon (wtedy się pojawi). Nie zmieniłem kodu, przestało działać.Brak TabLayout po aktualizacji Biblioteki Wsparcia Projektowego
Oto fragmenty:
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>
używam butterknife, nie sądzę, by to żadnej różnicy, ponieważ w poprzedniej wersji było z nim pracować.
Dzięki i każda pomoc będzie doceniona!
Nie możesz pokazać nam całego pliku XML? –
Oczywiście, po prostu edytowane. Dziękuję Ci. – Leonardo
Czy widziałeś: https://github.com/chrisbanes/cheesesquare? Używam podobnej konfiguracji. –