Note that there are some explanatory texts on larger screens.

plurals
  1. PORelative Layout Centering
    primarykey
    data
    text
    <p>Within the RelativeLayout I'm trying to figure out how to center the bottom TextView (@id/btn_traffic_map) horizontally below the other four TextViews. Everything else on the screen is centered except that one view. It is showing slightly right of center.</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/app_header_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/app_header_background"&gt; &lt;ImageView android:id="@+id/app_header_logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/app_header_logo"/&gt; &lt;TextView android:id="@+id/app_header_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|right" android:gravity="center" android:textStyle="bold" android:textColor="@color/app_header_text"/&gt; &lt;/FrameLayout&gt; &lt;RelativeLayout android:id="@+id/main_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center"&gt; &lt;TextView android:id="@+id/btn_news" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="10dp" android:gravity="center_horizontal" android:textSize="20sp" android:textStyle="bold" android:drawableTop="@drawable/home_news" android:text="News"/&gt; &lt;TextView android:id="@+id/btn_events" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/btn_news" android:gravity="center_horizontal" android:textSize="20sp" android:textStyle="bold" android:drawableTop="@drawable/home_events" android:text="Events"/&gt; &lt;TextView android:id="@+id/btn_wtmc" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="10dp" android:layout_below="@id/btn_news" android:gravity="center_horizontal" android:textSize="20sp" android:textStyle="bold" android:drawableTop="@drawable/home_wtmc_off" android:text="WTMC"/&gt; &lt;TextView android:id="@+id/btn_social" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/btn_events" android:layout_toRightOf="@id/btn_wtmc" android:gravity="center_horizontal" android:textSize="20sp" android:textStyle="bold" android:drawableTop="@drawable/home_social" android:text="Social"/&gt; &lt;TextView android:id="@+id/btn_traffic_map" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/btn_wtmc" android:layout_centerHorizontal="true" android:gravity="center_horizontal" android:textSize="20sp" android:textStyle="bold" android:drawableTop="@drawable/home_traffic" android:text="Traffic"/&gt; &lt;/RelativeLayout&gt; &lt;/LinearLayout&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.
    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