如何通过参数传递视图?
所以基本上我想要一个改变颜色的按钮,但我不会按下这个按钮,它是一个空闲按钮。其他按钮应该通过单击来更改此设置。
我想将视图传递给参数,然后使用该视图来更改背景颜色。
changeColorBlack(R.id.light);
这是我想到的关于如何传递它的行,但它一直说它是一个 int 并且无法传递。有没有其他方法可以做到这一点,或者甚至是可以轻松地从一种颜色更改为另一种颜色的图片,而不必担心使其成为课堂上可用的视图?
So basically I want to get a button to change color, but I won't be pressing this button, it is an idle button. Other buttons are supposed to change this by clicking them.
I want to pass the view into a parameter and then use that view to change the backgrounds color.
changeColorBlack(R.id.light);
this is the line I have in mind on how to pass it, but it keeps saying it is an int and cannot be passed. Is there another way to do this, or even a picture that is easily changed from color to color with out having to worry about making it a useable view in the class?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
然后你可以使用参数调用视图:
Then you can call a view with a parameter: