错误扔在改变alpha属性 [英] Error thrown on changing the alpha property

查看:82
本文介绍了错误扔在改变alpha属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到这个错误的alpha属性设置为视图

I get this error for setting the alpha property to a view

java.lang.NoSuchMethodError: android.view.View.setAlpha

在我的code

((View) findViewById(R.id.view)).setAlpha(100);

//with float value also doesn't works

可能是什么问题?我没有任何编译错误只是在运行时

What might be the problem ? I do not have any compile errors just on runtime

推荐答案

作为的文档状态, setAlpha 需要API 11.你可能有你的minSDK设置为低于11的东西,正在安装/设备上运行此这低于11.这意味着它没有这种方法,所以Java无法找到它。

As the documentation states, setAlpha requires API 11. You probably have your minSDK set to something below 11 and are installing/running this on a device which is below 11. That means it doesn't have this method, so Java can't find it.

这篇关于错误扔在改变alpha属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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