Implementing a TabListener using the Support Library

前端 未结 5 1694
终归单人心
终归单人心 2020-12-14 02:45

I am trying to implement Tab Navigation, but I want to make sure people that have older versions of Android can still use my application.

The app in mind ATM is fai

5条回答
  •  清歌不尽
    2020-12-14 03:35

    hmmm. while Malek's works it doesn't directly answer the question..

    You can simply ignore the fragment transaction you get in the callback and use your own:

    android.support.v4.app.FragmentTransaction fft = mActivity.getSupportFragmentManager().beginTransaction();
    

    Just make sure that your activity is a FragmentActivity and you'll be able to start a new fragment transaction.

    Also the replace() method in the fragmentTransaction is much more convenient than add() and remove()

提交回复
热议问题