gpt4 book ai didi

安卓 : Can't import ViewRoot

转载 作者:行者123 更新时间:2023-11-29 18:14:13 24 4
gpt4 key购买 nike

我正在编写一个应用程序,我想从一个 View 对象开始,然后使用 getParent() 向上遍历 View 层次结构直到我一路到达 ViewRoot,我希望使用 instanceof 检测它。

看起来很简单,但我已经遇到麻烦了,因为我似乎无法导入 ViewRoot。在我所在的线上:

import android.view.ViewRoot;

我得到:

The import android.view.ViewRoot cannot be resolved

我已经在这种环境中编写了数十个应用程序,在阳光下导入所有内容,但我从未遇到过这样的问题。

Eclipse 3.52,目标是 Android 2.2 及更高版本。

最佳答案

如果您只需要顶层 View ,View.getRootView() 会为您提供您所需要的吗?

关于安卓 : Can't import ViewRoot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9021685/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com