Add margin or padding to RadioButton into a RadioGroup programmatically
<p>I would like to add margin or padding to a RadioGroup programmatically but it not working.</p>

<p><strong>RadioButton:</strong></p>

<pre><code>&lt;RadioButton xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/ic_fruit"
    android:button="@null"
    android:checked="false" /&gt;
</code></pre>

<p><strong>RadioGroup:</strong></p>

<pre><code>&lt;RadioGroup
            android:id="@+id/radio_group"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:layout_marginTop="10dp"
            android:orientation="horizontal"&gt;

&lt;/RadioGroup&gt;
</code></pre>

<p><strong>Java code:</strong></p>

<pre><code>RadioButton radioButtonView = (RadioButton) getActivity().getLayoutInflater().inflate(R.layout.radio_button, null);

radioGroup.addView(radioButtonView);
</code></pre>

<p>I tried to use <code>LayoutParams</code> and <code>dividerPadding</code> but it not works</p>

<p><a href="https://i.stack.imgur.com/KQsvk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KQsvk.png" alt="example"></a></p>