title: Android: How do I put a solid color rectangle in a Layout?
body: <p>I have a RelativeLayout that inflates just fine.  I would like to add a solid color rectangle spanning the width of the layout at the top.  I tried putting the following into my xml:</p>
  
  <pre><code>&lt;view android:id="@+id/top_alert"
      android:layout_width="match_parent"
      android:layout_height="2dp"
      android:layout_above="@+id/orders_gridview"
      android:layout_alignParentTop="true"
      android:background="@color/table_request_assistance"
      android:visibility="visible"/&gt;
  </code></pre>
  
  <p>Now, when I try to inflate my Layout I get a NullPointerException at LayoutInflater.createViewFromTag (line 715): </p>
  
  <pre><code>if (name.equals(TAG_1995)) {
  </code></pre>
  
  <p><code>name</code> is set earlier thusly:</p>
  
  <pre><code>if (name.equals("view")) {
      name = attrs.getAttributeValue(null, "class");
  }
  </code></pre>
  
  <p>Evidently there is no "class" attribute.  How do I add that?  I can't find anything close in <a href="http://schemas.android.com/apk/res/android" rel="noreferrer">http://schemas.android.com/apk/res/android</a>. Should I add it?  Is this the standard way to do this?  It seems like it should be the simplest thing in the world.</p>