I know this is a question that has been asked many times before, but I can\'t seem to solve it in my code. I have two buttons, and when one is pressed, I would like to keep
A checkbox could work, but if you're after a UI closer UISegmentedControl on iOS, which is possible wrapping all the buttons needed in a LinearLayout, then you could do something along the lines of:
public void onClick( View v ){
if ( v.getID == R.id.btn1 ) {
btn1.setEnabled(false);
btn2.setEnabled(true);
// do stuff
}
else if ( v.getId() == R.id.btn2 ) {
btn2.setEnabled(false);
btn1.setEnabled(true);
// do stuff
}
}
Of course, in your drawable folder, you would add background colour, borders, and other visual stuff for each state.