Unable to use Fragments with Android Compatibility Package

后端 未结 6 1045
一个人的身影
一个人的身影 2020-12-08 14:53

In \"Fragments for All\", Xavier Ducrohet, Android SDK Tech Lead says Google releases an Android Compatibility Package by SDK Manager.

I\'ve installed it, but, how c

6条回答
  •  無奈伤痛
    2020-12-08 15:03

    Premier,

    I followed the Fragments example on the Android Developers Blog to create a "backwards" compatible app using Fragments. In the article there is a brief mention of the Main activity that uses a layout with fragments.

    The code for this activity is not interesting; it just calls setContentView() with the given layout:

    What should be mentioned here is that this activity must derive from FragmentActivity and not Activity class. This threw me off for a while.

    Good luck

提交回复
热议问题