android.support.v4.util.Pair与android.util.Pair [英] android.support.v4.util.Pair vs android.util.Pair
问题描述
我阅读了有关support.v4
lib的信息,该文件允许android向后兼容.
I read about support.v4
lib that allows android backward compatibility.
因此,IIUC在存在歧义的情况下-始终最佳做法是从android.support.v4 ...
So IIUC, when there is an ambiguity - it's always best practice to import the lib from android.support.v4 ...
对吗?
推荐答案
是的,这很明智,但并非总是需要.
Yeah, it's wise but not always needed.
在这种情况下,Pair
是API 5和非常有用的类,因此将其添加到v4
库中.
I this case Pair
is API 5 and quite usefull class so it was added to v4
library.
另一个例子是Fragments
.如果您想将ViewPager
与Fragments
一起使用,则很可能需要v4
中的Fragments
,因为ViewPager
也来自v4
.
Another example are Fragments
. If you want to use ViewPager
with Fragments
most probably you need Fragments
from v4
as ViewPager
is from v4
as well...
这篇关于android.support.v4.util.Pair与android.util.Pair的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!