// If you're in an activity:
Button11.setBackgroundColor(getResources().getColor(R.color.red));
// OR, if you're not:
Button11.setBackgroundColor(Button11.getContext().getResources().getColor(R.color.red));
//Add this to your button xml element
android:background="@android:color/[INSERT_COLOR]"
//You might have to change the text color to make the text readable
//Change this line in both of the themes.xml files
<style name="Theme.[INSERT_APP_NAME]" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
//to
<style name="Theme.[INSERT_APP_NAME]" parent="Theme.AppCompat.DayNight.NoActionBar">
// you can change the .NoActionBar to light action bar or dark action bar if you want to
Button11.setBackgroundColor(0xFFFF0000); // 0xAARRGGBB
startBtn.getBackground().setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_ATOP);
replace <Button with <androidx.appcompat.widget.AppCompatButton