title: How to center image and text in a RadioButton?
body: <p>I have two custom RadioButtons side by side that fill the width of the screen. I want to have text and an image to the right of the text, centered in the button.</p>
  
  <p>drawableRight draws the image way off to the right of the button, not near the text. I can't use drawableEnd because I don't have Android 4.0</p>
  
  <p>I've tried using a Spannable, but the problem with that is that the image is bigger than the text. I don't want it aligned with the bottom or baseline of the text; I want it to be centered in the button on its own.</p>
  
  <p>The best solution I've found is making a clickable RelativeLayout with a TextView and ImageView centered in it. This makes the button look the way I want it to, but it seems like a lot of work to do that, and to program each RelativeLayout to act like a RadioButton in a RadioGroup.</p>
  
  <p>Is there an easier way, or something that I'm missing? Or should I keep my RelativeLayout idea? Here's my xml for this:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"&gt;
      &lt;RelativeLayout
          android:id="@+id/first_relativelayout"
          android:clickable="true"
          android:background="@drawable/radio_button"
          android:layout_weight="1"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:gravity="center_horizontal"&gt;
          &lt;TextView
              android:id="@+id/first_textview"
              android:text="@string/first_radiobutton_label"
              android:textAppearance="?android:attr/textAppearanceButton"
              android:textColor="@android:color/white"
              android:layout_centerVertical="true"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"&gt;&lt;/TextView&gt;
          &lt;ImageView
              android:contentDescription="@string/image_description"
              android:id="@+id/first_imageview"
              android:layout_centerVertical="true"
              android:src="@drawable/it"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_toRightOf="@id/first_textview"&gt;
          &lt;/ImageView&gt;
      &lt;/RelativeLayout&gt;
  
       &lt;RelativeLayout
          android:id="@+id/second_relativelayout"
          android:clickable="true"
          android:background="@drawable/radio_button"
          android:layout_weight="1"
          android:layout_width="0dip"
          android:layout_height="wrap_content"
          android:gravity="center_horizontal"&gt;
          &lt;TextView
              android:id="@+id/second_textview"
              android:text="@string/second_radiobutton_label"
              android:textAppearance="?android:attr/textAppearanceButton"
              android:textColor="@android:color/white"
              android:layout_centerVertical="true"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"&gt;&lt;/TextView&gt;
          &lt;ImageView
              android:contentDescription="@string/image_description"
              android:id="@+id/second_imageview"
              android:layout_centerVertical="true"
              android:src="@drawable/it"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_toRightOf="@id/second_textview"&gt;
          &lt;/ImageView&gt;
  &lt;/RelativeLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>