问题描述
与 android.app.Fragment
的区别,什么是 android.support.v4.app.Fragment
,什么是其中每个应使用的情况?
What is the difference between android.app.Fragment
and android.support.v4.app.Fragment
, and what are the circumstances in which each should be used?
推荐答案
android.support.v4.app.Fragment
是类在android支持库,这是一个兼容包,使您可以使用一些Android系统的新功能在旧版本的Android。
android.support.v4.app.Fragment
is the Fragment class in the android support library, which is a compatibility package that allows you to use some of the newer features of Android on older versions of Android.
android.app.Fragment
的片段类在Android SDK的原生版本。据介绍在的Android 3.0(API 11)。
android.app.Fragment
is the Fragment class in the native version of the Android SDK. It was introduced in Android 3 (API 11).
如果你想使你的应用程序使用的片段,并希望API 11日之前到目标设备,则必须使用 android.support.v4.app.Fragment
。但是,如果你只针对以上运行的API 11台设备,你可以使用 android.app.Fragment
。
If you want to make your app use fragments, and want to target devices before API 11, you must use android.support.v4.app.Fragment
. However, if you're only targeting devices running API 11 or above, you can use android.app.Fragment
.
这篇关于android.app.Fragment和android.support.v4.app.Fragment的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!