xxxxxxxxxx
replace <Button with <androidx.appcompat.widget.AppCompatButton
xxxxxxxxxx
// 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));
xxxxxxxxxx
//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
xxxxxxxxxx
startBtn.getBackground().setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_ATOP);