I\'m using Android Studio. I need to change the color of the Radio Button, after changing the Button Tint Color value to the one I need it works on the preview, but whenever
I have done this way:
Screenshot
activity_main.xml
MainActivity.java
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
RadioGroup radioGroup = (RadioGroup) findViewById(R.id.radioGroup);
/**
* First Radio Buttonn
*/
RadioButton radioButtonAndroid = (RadioButton) getLayoutInflater().inflate(R.layout.custom_radiobutton, null);
radioButtonAndroid.setText("Hello Android");
radioGroup.addView(radioButtonAndroid);
/**
* Second Radio Buttonn
*/
RadioButton radioButtonIos = (RadioButton) getLayoutInflater().inflate(R.layout.custom_radiobutton, null);
radioButtonIos.setText("Hello Ios");
radioGroup.addView(radioButtonIos);
}
}
custom_radiobutton.xml
Hope this will help you.