简体   繁体   English

如何获得ImageView的图像级别?

[英]How can I get the imagelevel of an ImageView?

In my app I'm using a few Imageviews with LevelListDrawables to be able to change then dynamically. 在我的应用程序中,我正在使用一些带有LevelListDrawables的Imageview,以便能够动态地进行更改。

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. 但现在我想知道我是否可以读取ImageView的哪个级别,我使用setImageLevel()设置级别,但是没有反对悬挂方法来获取imagelevel。

So my question is: Is there a way to get the current imagelevel of an imageview? 所以我的问题是:有没有办法获得imageview的当前图像级别?

You can't do it directly to the ImageView, but you can do this 您无法直接对ImageView执行此操作,但您可以执行此操作

imageView.getDrawable().getLevel()

That will do the trick, for further information the offical documentation for Drawable#getLevel() 对于Drawable#getLevel()的官方文档的进一步信息,这将有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM