title: Radio Button style programmatically
body: <p>I would to create a number of radio button dinamically in a fragment, I only have problem with style. If I put radiobutton code in the xml file, default style is applied correctly, but when I create radiobutton through a function I see different style!</p>
  
  <p>XML</p>
  
  <pre><code>&lt;RadioGroup
              android:id="@+id/radiogroup"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:orientation="vertical"
              android:animationCache="false"&gt;
  
              &lt;RadioButton
                  android:text="RadioButton 1"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:id="@+id/radioButton3" /&gt;
  
              &lt;RadioButton
                  android:text="RadioButton 2"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:id="@+id/radioButton4" /&gt;
  
  
  &lt;/RadioGroup&gt;
  </code></pre>
  
  <p>RESULT</p>
  
  <p><a href="https://i.stack.imgur.com/NbOVv.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/NbOVv.jpg" alt="enter image description here"></a></p>
  
  <p>JAVA CODE</p>
  
  <p>This code is put in onCreateView in the fragment</p>
  
  <pre><code>public void addRadioButton(Context ctx,int num){
  
      RadioGroup radioGroup= (RadioGroup) alertInflatedView.findViewById(R.id.radiogroup);
  
      for (int i = 1; i &lt;= num; i++) {
          RadioButton radioButton  = new RadioButton(ctx);
          radioButton.setId(1+i);
          radioButton.setText("Radio " + radioButton.getId());
          radioButton.setTextColor(getResources().getColor(R.color.black));
  
          radioGroup.addView(radioButton);
  
      }
  
  }
  </code></pre>
  
  <p>RESULT</p>
  
  <p><a href="https://i.stack.imgur.com/3S20x.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/3S20x.jpg" alt="enter image description here"></a></p>
  
  <p>As you can see radio buttons have different style, someone could help me, if is possibile, to apply default style programmatically?</p>