为preferenceFragment故意排除在兼容包? [英] Was PreferenceFragment intentionally excluded from the compatibility package?

查看:359
本文介绍了为preferenceFragment故意排除在兼容包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在找编写能够同时适用于3.0和pre-3.0设备preferences。发现了 preferenceActivity 包含德precated方法(虽然这些都在所附的样品code使用的),我看着 preferenceFragement 和兼容包,以解决我的困境。

看来,虽然, preferenceFragment 不在兼容包。谁能告诉我这是否是故意的吗?如果是的话,我可以轻松地在各种设备(如< 3.0和> = 3.0)或将我赴汤蹈火?如果不是刻意排斥,我们能期望兼容包的新版本?还是有另一种解决方法就是使用安全?

干杯

詹姆斯

解决方案
  

发现了preferenceActivity包含德precated方法(虽然这些都在所附的样品code使用的)

pcated

本德$ P $方法pcated成为Android 3.0的去$ P $。他们是完全没有在所有版本的Andr​​oid,但方向是使用 preferenceFragment 在Android 3.0及更高版本。

  

谁能告诉我这是否是故意的吗?

我的猜测是它的工程时间的问题,但是这只是一个猜测。

  

如果是这样,我可以轻松地在各种设备(如< 3.0和> = 3.0)?或者我会赴汤蹈火

我认为这是做容易。有两个单独的 preferenceActivity 的实现,一个使用preference头和 preferenceFragments ,其他使用原来的做法。选择是正确的,在你需要的点(例如,当用户点击选项菜单项)。 这里是证明这是一个示例项目。或者说,有一个 preferenceActivity 处理这两种情况下,如在的此示例项目

  

如果这不是刻意排斥,我们能期望兼容包的新版本?

您会发现,当我们其余的人找出来,这是说,如果当它的船只。

  

还是有另一种解决方法就是使用安全?

见上面。

I'm looking to write preferences that can be applied to both 3.0 and pre-3.0 devices. Discovering that PreferenceActivity contains deprecated methods (although these are used in the accompanying sample code), I looked at PreferenceFragement and the compatibility package to solve my woes.

It appears, though, that PreferenceFragment isn't in the compatibility package. Can anyone tell me whether this was intentional? If so, can I easily target a range of devices (i.e. < 3.0 and >=3.0) or will I have to jump through hoops? If it wasn't intentionally excluded, can we expect a new release of the compatibility package? Or is there another workaround that is safe to use?

Cheers

James

解决方案

Discovering that PreferenceActivity contains deprecated methods (although these are used in the accompanying sample code)

The deprecated methods are deprecated as of Android 3.0. They are perfectly fine on all versions of Android, but the direction is to use PreferenceFragment on Android 3.0 and higher.

Can anyone tell me whether this was intentional?

My guess is it's a question of engineering time, but that's just a guess.

If so, can I easily target a range of devices (i.e. < 3.0 and >=3.0) or will I have to jump through hoops?

I consider it to be done "easily". Have two separate PreferenceActivity implementations, one using preference headers and PreferenceFragments, the other using the original approach. Choose the right one at the point you need to (e.g., when the user clicks on the options menu item). Here is a sample project demonstrating this. Or, have a single PreferenceActivity that handles both cases, as in this sample project.

If it wasn't intentionally excluded, can we expect a new release of the compatibility package?

You will find out when the rest of us find out, which is to say, if and when it ships.

Or is there another workaround that is safe to use?

See above.

这篇关于为preferenceFragment故意排除在兼容包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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