title: Android Studio XML Requires Layout_Height and Layout_Width
body: <p>I found this code while searching for a button with good graphics, </p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" &gt;
  &lt;corners
  android:radius="100dp"
  /&gt;
  &lt;gradient
  android:angle="45"
  android:centerX="35%"
  android:centerColor="#7995A8"
  android:startColor="#E8E8E8"
  android:endColor="#000000"
  android:type="linear"
  /&gt;
  &lt;padding
  android:left="0dp"
  android:top="0dp"
  android:right="0dp"
  android:bottom="0dp"
  /&gt;
  &lt;size
  android:width="270dp"
  android:height="60dp"
  /&gt;
  &lt;stroke
  android:width="3dp"
  android:color="#878787"
  /&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>However, when I copy and paste it into an XML file in Android Studio, it shows and error that says:</p>
  
  <blockquote>
    <p>"element shape does not have required attribute android:layout_height" </p>
  </blockquote>
  
  <p>and another error:</p>
  
  <blockquote>
    <p>"element shape does not have required attribute android:layout_width"</p>
  </blockquote>
  
  <p>I tried setting the <code>android:layout_width=""</code> and <code>android:layout_heigth""</code>
  and <code>android:layout_width"wrap_content"</code>, <code>android:layout_heigth="wrap_content"</code>, the error is gone, but I can't set any button to have this as it's background ... so I can't use this XML this way.</p>
  
  <p>What should I set them to?</p>