Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I make a button fill the screen (in width) using relative layout?
    primarykey
    data
    text
    <p>I am new to android development and I want to make my button cover the WHOLE width of the page with no space on either side. I have researched this and using android weight doesn't work.</p> <p>Here is the XML:</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" style="@style/AppTheme" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/background" android:icon="@drawable/ic_launcher" android:scrollbars="horizontal|vertical" tools:context=".MainActivity" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="98dp" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:background="@drawable/buttonpress" android:text="@string/hello_world" android:textColor="#228496" android:textSize="14sp" /&gt; &lt;Button android:id="@+id/categories" android:layout_width="fill_parent" android:layout_height="50dp" android:layout_below="@+id/textView1" android:layout_centerHorizontal="true" android:layout_marginTop="14dp" android:background="@drawable/buttonpress" android:onClick="Categories" android:text="@string/title_activity_categories" android:textColor="#228496" android:textSize="21sp" /&gt; &lt;Button android:id="@+id/feedback" android:layout_width="fill_parent" android:layout_height="50dp" android:layout_alignLeft="@+id/categories" android:layout_below="@+id/categories" android:layout_marginTop="15dp" android:background="@drawable/buttonpress" android:onClick="feedback" android:text="@string/Feedback" android:textColor="#228496" android:textSize="21sp" /&gt; &lt;/RelativeLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload