本文介绍了片段或支持片段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发支持Android的> = 4.0的应用程序。它使用了 android.app 包片段。由于我所面临的问题与旧片段实施4.0,如这个,那已经固定在支持库,我正在考虑切换回片段实现从支持库,以获得更可靠和一致的实施。

I am developing an app that supports Android >= 4.0. It uses fragments from the android.app package. As I am facing problems with the older fragment implementation in 4.0, like this one, that are already fixed in the support library, I am considering switching back to the fragment implementation from the support library to get a more reliable and consistent implementation.

为您的意见对这个怎么办?您是否正在使用从支持库的片段,即使它们已经上市,为Android开发4时?

What is your opinion on this? Are you using fragments from the support library, even though they are already available, when developing for Android 4?

推荐答案

根据我的经验,使用相同的片段执行的所有Android设备是一个很大的优势。我无法摆脱所有NullPointerException异常时,状态保存在Android 4.0使用原生片段,与支持库,他们都走了。我也看不出任何缺点到目前为止,这种做法。

From my experience, using the same fragment implementation on all Android devices is a great advantage. I could not get rid of all NullPointerExceptions when state is saved on Android 4.0 using native fragments, with the support library they are all gone. Also I could not see any disadvantage so far with this approach.

所以,我的回答我自己的问题现在是:在开发针对Android 4.x中,用碎片的支持库是一个好主意。支持库已修复的错误仍在present老年片段实现,并经常更新,更多的bug修复。

So my answer to my own question is now: When developing for Android 4.x, using the fragments from the support library is a good idea. The support library has bugs fixed that are still present in older fragment implementations and is frequently updated with more bug fixes.

这篇关于片段或支持片段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 17:24
查看更多