如何获取 ImageView 的图像级别?

发布于 2024-12-17 22:03:29 字数 183 浏览 2 评论 0原文

在我的应用程序中,我使用一些带有 LevelListDrawables 的 Imageview 以便能够动态更改。

但现在我想知道我是否可以读取 ImageView 所声明的级别,我使用 setImageLevel() 设置级别,但没有反对悬挂方法来获取图像级别。

所以我的问题是:有没有办法获取图像视图的当前图像级别?

In my app I'm using a few Imageviews with LevelListDrawables to be able to change then dynamically.

But now I want to know if I can read in which level the ImageView is stated, I set the level with setImageLevel() but there is no against hanging method to get the imagelevel.

So my question is: Is there a way to get the current imagelevel of an imageview?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

妄想挽回 2024-12-24 22:03:29

你不能直接对 ImageView 执行此操作,但你可以这样做

imageView.getDrawable().getLevel()

,这将达到目的,有关详细信息,请参阅 Drawable#getLevel()

You can't do it directly to the ImageView, but you can do this

imageView.getDrawable().getLevel()

That will do the trick, for further information the offical documentation for Drawable#getLevel()

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文