【发布时间】:2013-02-11 22:23:13
【问题描述】:
在我的应用程序中,最初我将 TextView 的不透明度设置为 60。
之后,当用户按下按钮时,我想根据按下增加它的按钮或减少它的按钮来减少或增加TextView 的不透明度。
我试过这个,但每次当我得到文本的不透明度时,它的 -3 或 -1 实际上不是。
public void decreaseOpacity(View v){
int op=txtView.getBackground().getOpacity();// its alwz -ve value
txtView.getBackground().setAlpha(op-1);
}
【问题讨论】: