1
我使用Android Studio在Android中编程,我需要在按钮上设置RGB比例的颜色(不是在xml中,而是在java代码中)。我能怎么做?Android Studio - 在按钮上设置RGB
我使用Android Studio在Android中编程,我需要在按钮上设置RGB比例的颜色(不是在xml中,而是在java代码中)。我能怎么做?Android Studio - 在按钮上设置RGB
只要把你的RGB码本网站http://www.rgbtohex.net/并与十六进制代码(以#开头的那个)使用方法:
button.setBackgroundColor(Color.parseColor(hexcodefromwebsite));
Button button = (Button)findViewById(R.id.YOUR_BUTTON_ID);
button.setBackground(R.color.YOUR_COLOR_RESOURCE);
谢谢,我还有一个问题:我怎么能使用的值设置颜色RG和B? – EmLe49