I am just trying to do some basic coding. I have a button which when clicked I want it to change the tint color of a drawable image I have. But I am not sure how I can change the tint when the button is pressed. Any help would be most welcome!
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button myYellow_Button = (Button) findViewById(R.id.Yellow_Button);
myYellow_Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
box.setBackground(colorPrimary);
}
}
I am not sure how to reference the XML script to change the Tint, I have experimented with SetBackground but I haven't got anywhere with it.