背景
我正在使用this library,它的一个类(从ViewGroup扩展)在CTOR中的“PLA_AbsListView.java”中,有以下几行:
final TypedArray a = context.obtainStyledAttributes(R.styleable.View);
initializeScrollbars(a);
a.recycle();
最近,我更新了Android的SDK和ADT以支持新的Android版本(Lollipop-API21)。
问题
自从我更新了所有内容之后,我一直收到此错误:
我尝试过的
我试图将API设置为低于21,但没有帮助。
我也试图找出该函数的声明位置。它应该是“View.java”中的一个 protected 函数,但是由于某种原因,我在the documentations中看不到它
问题
怎么会这样?
我该如何解决?
有可能是文档中的错误吗?
之前针对Kitkat时,它就奏效了...
最佳答案
来自View.java
来源的android-21
:
/**
* ...
*
* @removed
*/
protected void initializeScrollbars(TypedArray a) {
// It's not safe to use this method from apps. The parameter 'a' must have been obtained
// using the View filter array which is not available to the SDK. As such, internal
// framework usage now uses initializeScrollbarsInternal and we grab a default
// TypedArray with the right filter instead here.
TypedArray arr = mContext.obtainStyledAttributes(com.android.internal.R.styleable.View);
initializeScrollbarsInternal(arr);
// We ignored the method parameter. Recycle the one we actually did use.
arr.recycle();
}
/**
* ...
*
* @hide
*/
protected void initializeScrollbarsInternal(TypedArray a) {
您看不到它,因为该方法带有
@removed
注释。 initializeScrollbarsInternal()
也必须使用@hide
注释,因此也不能使用。从注释中可以看出,使用此方法并不安全,因此您应该将其报告给lib的作者。
关于android - initializeScrollbars是否未定义?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26448771/