android.support.v4.util.Pair与android.util.Pair [英] android.support.v4.util.Pair vs android.util.Pair

查看:242
本文介绍了android.support.v4.util.Pair与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 v4library.

另一个例子是Fragments.如果您想将ViewPagerFragments一起使用,则很可能需要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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆