title: How to add an image to a button in android
body: <p>I was wondering how I put an image to a button.</p>
  
  <p>I have tried to use "android:icon="@drawable/search.png"
  and I add this image to the drawable-hdpi folder but the image doesn't show up. I am developing an application for the nexus 4 so I don't know what size the image should be. The image I am trying to add is a normal search icon used in the contact manager of the nexus 4.</p>
  
  <p>The code I have written so far.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" &gt;
  
      &lt;TextView
          android:id="@+id/lbl_group_coworkers"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Coworkers"
          android:layout_marginTop="5dp"
          android:layout_marginBottom="5dp" /&gt;
  
      &lt;TextView 
          android:id="@+id/lbl_group_family"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Family"
          android:layout_marginTop="5dp"
          android:layout_marginBottom="5dp"/&gt;
      &lt;TextView
          android:id="@+id/lbl_group_friends"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Friends"
          android:layout_marginTop="5dp"
          android:layout_marginBottom="5dp" /&gt;
  
      &lt;LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="0dip"
          android:layout_weight="1"
          android:orientation="vertical" &gt;
  
  
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal" &gt;
  
          &lt;Button
              android:id="@+id/Button1"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="0.70"
              android:icon="@drawable/search.png" /&gt;
  
          &lt;Button
              android:id="@+id/Button2"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:onClick="addGroup"
              android:icon="@drawable/addgroup.png"/&gt;
  
          &lt;Button
              android:id="@+id/Button3"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_weight="0.11"
              android:text="@string/Button3" /&gt;
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>