操作栏福尔摩斯拥有德precated方法 [英] Action Bar Sherlock has deprecated methods

查看:287
本文介绍了操作栏福尔摩斯拥有德precated方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载的版本ActionBarSherlock 4.1.0.0,和我的Win7的Java 1.6更新24机加入了Android的项目库到Eclipse 4.2。我用了一个Eclipse项目构建Android 4.1项目目标|属性|项目建设目标。我想纳入动作条功能集成到现有的应用程序具有的minSdkVersion =7。我注意到,code从ActionBarSherlock库显得有一些德precated方法,和一个错误:

I downloaded the ActionBarSherlock version 4.1.0.0, and added a the Android Project library into Eclipse 4.2 on my Win7 java 1.6 update 24 machine. I used an Eclipse Project Build Target of Android 4.1 in Project | Properties | Project Build Target. I want to incorporate the ActionBar functionality into an existing app that has minSdkVersion="7". I noted the code from the ActionBarSherlock library appears to have some deprecated methods, and an error:

例1:ActionBarContainer.java,ActionBarContextView.java,ScrollingTabContainerView.java - 使用setBackgroundDrawable - 从类型视图的方法setBackgroundDrawable(绘制对象)是pcated德$ P $

Example 1: ActionBarContainer.java, ActionBarContextView.java, ScrollingTabContainerView.java - uses setBackgroundDrawable - The method setBackgroundDrawable(Drawable) from the type View is deprecated

public ActionBarContainer(Context context, AttributeSet attrs) {
    super(context, attrs);

    setBackgroundDrawable(null);

    TypedArray a = context.obtainStyledAttributes(attrs,
            R.styleable.SherlockActionBar);
    mBackground = a.getDrawable(R.styleable.SherlockActionBar_background);
    mStackedBackground = a.getDrawable(
            R.styleable.SherlockActionBar_backgroundStacked);

    if (getId() == R.id.abs__split_action_bar) {
        mIsSplit = true;
        mSplitBackground = a.getDrawable(
                R.styleable.SherlockActionBar_backgroundSplit);
    }
    a.recycle();

    setWillNotDraw(mIsSplit ? mSplitBackground == null :
            mBackground == null && mStackedBackground == null);
}

快速修复显示为添加@苏pressWarnings去precation'的ActionBarContainer

Quick fix shows as Add @SupressWarnings 'deprecation' for ActionBarContainer

实施例2:
IcsProgressBar.java使用animationResolution这表明作为德precated,同样速战速决如上

Example 2: IcsProgressBar.java uses animationResolution which shows as deprecated, same quick fix as above

private static final int[] ProgressBar = new int[] {
    ...
    android.R.attr.animationResolution

另外,我在ActivityChooserView.java一个错误:

Also, I have an error in ActivityChooserView.java:

private static class SetActivated {
    public static void invoke(View view, boolean activated) {
        view.setActivated(activated);
    }
}

错误是SetActivated - 呼叫需要11 API(当前min为7)。这使得基于该清单意义:

Error is on SetActivated - Call requires API 11 (current min is 7). This makes sense based on the manifest:

<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/>

应该不是API 7被罚款,因为操作栏福尔摩斯应该在的Andr​​iod 2.x的工作吗?有没有其他人经历过这个,如果是这样,什么是建议操作?苏preSS /忽略德precation?怎么样在SetActivated的错误?我回顾自述做了一些网搜索,但没有拿出这个东西。感谢您的任何建议。

Shouldn't API 7 be fine, since Action Bar Sherlock should work at at Andriod 2.x? Have others experienced this, and if so, what is the recommended action? Supress/ignore the deprecation? What about the error on SetActivated? I reviewed the readme and did some net searches but did not come up with anything on this. Thanks for any suggestions.

谢谢!

推荐答案

有就好了。在code是2.x的兼容,甚至一些方法去precated 作为4.x版的后,他们还在那里。这也并不意味着对这些4.x的德precated方法将被使用。来源是2.X-4.x的,所以没有其他的方式(更不用提反思,但会影响性能,而且现在没有必要)。因此,它是安全的,只是忽略这一点。它可能会更好地把德preciation关闭特定文件,但它不存在。所以不要担心。

It is just fine. The code is 2.x compatible and even some methods are deprecated as of 4.x, they are still there. It also do not mean on 4.x these deprecated methods will be used. The source is 2.x-4.x so there's no other way (not to mention reflection, but that'd hurt performance, and is for now not necessary). So it is safe to just ignore this. It would probably be better to turn depreciation off for certain files but it is not there. So do not worry.

这篇关于操作栏福尔摩斯拥有德precated方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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