Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7191543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:45:04+00:00 2026-05-28T19:45:04+00:00

Within the RelativeLayout I’m trying to figure out how to center the bottom TextView

  • 0

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.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

  <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">

    <ImageView
      android:id="@+id/app_header_logo"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:src="@drawable/app_header_logo"/>

    <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"/>
  </FrameLayout>

  <RelativeLayout
    android:id="@+id/main_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center">

    <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"/>

    <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"/>

    <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"/>

    <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"/>

    <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"/>

  </RelativeLayout>
</LinearLayout>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:45:07+00:00Added an answer on May 28, 2026 at 7:45 pm

    put RelativeLayout inside LinearLayout

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center" >
     <RelativeLayout
            android:id="@+id/main_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center" >
    
         /////////////////////
        <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_centerInParent="true" //important line
             android:text="Traffic"
             android:textSize="20sp"
             android:textStyle="bold" />
          </RelativeLayout>
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i was trying to layout views within RelativeLayout like this: <?xml version=1.0 encoding=utf-8?> <RelativeLayout
In the image below, the yellow square represents a RelativeLayout that's within my overall
I am displaying the TextView within a RelativeLayout . I want to put the
I have a RelativeLayout within a ScrollView , I am trying to move the
Within an asp.net MVC app, I'm trying to find rooms which have a guest/client,
I'm trying to do some touchUtil on a button within a relative layout that
I have to add two relative layouts next to each other horizontally in android.I
I have a relativelayout with 30 buttons within a scrollview. What I would like
I am attempting to vertically centre a TextView element within a listview row. The
Im trying to create a Spinners within a ListView, but i dont know how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.