本文介绍了setAlpha和setImageAlpha的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有两个相关的方法方法:setAlpha和setImageAlpha.前者是因为API 1级可用,但由于16级去precated后者是可用,因为16级还有另一个setAlpha方法,从类,这是在API级别11引入的。

ImageView has two methods related methods: setAlpha and setImageAlpha. The former is available since API level 1, but is deprecated since level 16. The latter is available since level 16. There's also another setAlpha method, from the View class and this is introduced in API level 11.

仅在命名的ImageView#setAlpha和ImageView的#setImageAlpha之间的区别?是否有任何行为差异?什么是浏览#setAlpha和ImageView的#setAlpha?

Is the difference between ImageView#setAlpha and ImageView#setImageAlpha only in the naming? Is there any behavioral difference? What's the relationship between View#setAlpha and ImageView#setAlpha?

推荐答案


  • View.setAlpha(浮点)接受浮点值作为输入,并预计将在范围0..1的包容性。
  • 的值
  • ImageView.setAlpha(INT)接受一个int作为输入,并预计在包括的范围0..255的值。 ImageView.setAlpha(INT)是pcated德$ P $。这可能是因为他们想删除与冲突的根本 View.setAlpha(浮点)

  • 至于其他响应者所指出的 ImageView.setImageAlpha(INT)只是调用通过对德precated ImageView.setAlpha(INT) 。你应该想到的是 ImageView.setAlpha(INT)将在未来的API更新中删除,因此应避免使用它。

  • View.setAlpha(float) accepts a float as input and expects a value in the range 0..1 inclusive.
  • ImageView.setAlpha(int) accepts an int as input and expects a value on the range 0..255 inclusive. ImageView.setAlpha(int) is deprecated. This is probably because they wanted to remove the conflict with the underlying View.setAlpha(float)
  • As other responders have pointed out ImageView.setImageAlpha(int) simply calls through to the deprecated ImageView.setAlpha(int). You should expect that ImageView.setAlpha(int) will be removed in a future API update and should therefore avoid using it.
  • 这篇关于setAlpha和setImageAlpha的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 10:59