android-如何获取Button的背景颜色

xiaoxiao2021-02-28  121

class button extend Button{//重新个类继承Button private int background;       public void setBackground(int resId){                     super.setBackground(resId);                     this.background=resId;       } public int getBackground(){//增加获取背景色的方法    return this.background; } }

然后我们使用Button时,就使用这个我们自定义的button。

Button button = new button(); button.setBackground(1); button.getBackground();

 

转载请注明原文地址: https://www.6miu.com/read-25128.html

最新回复(0)