Android make button 1/3 of screen width and height in relative layout
<p>I have some XML. In this XML there is a single button inside a relative layout. The relative layout takes up the entire screen. I want the button to have 1/3 of the screen width and height. How could I do this?</p>

<p>Here is the XML:</p>

<pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
 &lt;RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="0dp"
    android:paddingRight="0dp"
    android:paddingTop="0dp"
    android:paddingBottom="0dp"
    tools:context="com.vroy.trapper.MainMenuActivity"
    android:layout_weight="2"&gt;

    &lt;Button
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:text="@string/menu_button_text"
        android:background="@drawable/round_button"
        android:id="@+id/button"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        /&gt;
&lt;/RelativeLayout&gt;
</code></pre>

<p>I looked at <a href="https://stackoverflow.com/questions/2581481/assign-width-to-half-available-screen-width-declaratively">this</a> question, but even though I assigned a weight to the relative layout itself I could not assign a weight to the button.</p>