initializeScrollbars是未定义的? [英] initializeScrollbars is undefined?

查看:192
本文介绍了initializeScrollbars是未定义的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景



我正在使用 此库 对于其中一个类(从ViewGroup扩展),在CT_A中的PLA_AbsListView.java中,有以下行:

  final TypedArray a = context.obtainStyledAttributes(R.styleable.View); 
initializeScrollbars(a);
a.recycle();

最近,我更新了SDK& ADT的Android支持新的Android版本(Lollipop - API21)。



问题



自从我我已经更新了一切,我不断得到这个错误:


方法initializeScrollbars(TypedArray)未定义类型PLA_AbsListView




我试过了



我试图将API设置为低于21,但没有帮助。



我还试图找出声明此功能的位置。它应该是View.java中的受保护函数,但由于某种原因,我无法在 文档



问题



怎么可能是吗?



如何解决?



文档中是否有可能出现错误? p>

以前的工作,当定位Kitkat ...

解决方案

code> View.java android-21 来源:

  / ** 
* ...
*
* @removed
* /
protected void initializeScrollbars(TypedArray a){
//从应用程序使用此方法是不安全的。必须使用SDK不可用的View filter array获得参数'a'
//。因此,内部
//框架使用现在使用initializeScrollbarsInternal,并且我们在这里使用正确的过滤器获取默认的
// TypedArray。
TypedArray arr = mContext.obtainStyledAttributes(com.android.internal.R.styleable.View);

initializeScrollbarsInternal(arr);

//我们忽略了方法参数。回收我们实际使用的那个。
arr.recycle();
}

/ **
* ...
*
* @hide
* /
protected void initializeScrollbarsInternal TypedArray a){

您没有看到它,因为该方法用 @removed initializeScrollbarsInternal()也不能使用,因为它被注释为 @hide
从评论来看,使用这种方法是不安全的,你一定要向lib的作者报告。


Background

I'm using this library which for one of its classes (that extends from ViewGroup), in "PLA_AbsListView.java", inside the CTOR, there are those lines:

    final TypedArray a = context.obtainStyledAttributes(R.styleable.View);
    initializeScrollbars(a);
    a.recycle();

Recently, I've updated the SDK & ADT of Android to support the new Android version (Lollipop - API21) .

The problem

Ever since I've updated everything, I keep getting this error:

The method initializeScrollbars(TypedArray) is undefined for the type PLA_AbsListView

What I've tried

I've tried to set the API to be used as lower than 21, but it didn't help.

I've also tried to find out where this function is declared. It's supposed to be a protected function within "View.java", but for some reason, I can't see it in the documentations

The question

How could it be?

How can I fix it?

Is it possible it's a bug in the documentation?

It worked before, when targeting Kitkat...

解决方案

from View.java of android-21 sources:

/**
 * ...
 *
 * @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) {

You don't see it because the method is annotated with @removed. initializeScrollbarsInternal() also cannot be used as it is annotated with @hide. As from the comment it's not safe to use this method, you should definitely report it to the author of the lib.

这篇关于initializeScrollbars是未定义的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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