【问题标题】:Click button to chang color in new activity -android studio单击按钮以更改新活动中的颜色-android studio
【发布时间】:2020-02-05 01:08:49
【问题描述】:

我想改变按钮的颜色。 当您按下按钮时,它将显示供您选择红色、蓝色、绿色以及当您选择一种颜色时。该颜色将显示在第一次按下的按钮上。

我读到了问题---->Click Button and change background color of another button 但我不明白。

【问题讨论】:

标签: java android


【解决方案1】:

为此,您可以创建一个带有按钮的警报对话框 在你必须添加的按钮中。

  buttunname.setBackgroundColor(thecolor);

然后如果单击按钮,按钮的背景将在之后更改为您选择的颜色

【讨论】:

    猜你喜欢
    • 2021-07-07
    • 1970-01-01
    • 1970-01-01
    • 2021-09-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-14
    • 2012-12-06
    相关资源
    最近更新 更多