Android - Fragment API for API level < 11

前端 未结 4 921
名媛妹妹
名媛妹妹 2020-12-10 01:47

I have came across a problem for dynamic forms in my app, which is suited for Android 2.1 and above. I know there is new Fragment API since API level 11 (Android 3.0 Honeyco

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-10 02:15

    Android Studio:

    Add a dependency for support compatibility package v4:

    dependencies {
        ...
        compile 'com.android.support:support-v4:21.0.+'
        ...
    }
    

    and then use import android.support.v4.app.Fragment; instead of import android.app.Fragment; in imports.

提交回复
热议问题