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 9228005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:13:16+00:00 2026-06-18T05:13:16+00:00

I have a very simple problem, but I am clearly doing something wrong. I’ve

  • 0

I have a very simple problem, but I am clearly doing something wrong. I’ve tried many ways to do this, but there’s always something screwing up.

I have a ListView with a horizontal LinearLayout serving as a header. I want to have < and > serving as “back and next” widgets, on the very left and very right portions of the LinearLayout. The LIST HEADER portion should be centered between them.

Making LIST HEADER have the attribute android:layout_width="match_parent" cuts off the right hand arrow. Otherwise it lays on top of the left arrow, even though it appears after the LIST HEADER TextView in the XML file.

<     LIST HEADER     >
List item number 1
List item number 2
List item number 3

I’m not new to Android at this stage but this seems basic. Any help would be appreciated.
I should add that I’m not using eclipse.

CURRENT XML (sort of messy after trying so many things, apologies):

<LinearLayout
android:orientation="vertical"  
android:layout_width="match_parent"
android:layout_height="match_parent">

  <LinearLayout
  android:orientation="horizontal"
  android:gravity="center"
  android:layout_width="match_parent"
  android:layout_height="wrap_content">
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

  <RelativeLayout
      android:id="@+id/LeftFormulaHeaderLayout"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content">
  <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="left"
      android:textSize="@dimen/text_huge"
      android:id="@+id/LeftFormulaHeader"
      android:text="&lt;"/>
  </RelativeLayout>
  <TextView
      android:layout_width="200dip"
      android:layout_height="wrap_content"
      android:textSize="@dimen/text_huge"
      android:ellipsize="end"
      android:scrollHorizontally="false"
      android:singleLine="true"
      android:gravity="center"
      android:id="@+id/FormulaHeader"/>

  <RelativeLayout
      android:id="@+id/RightFormulaHeaderLayout"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content">
    <TextView
    android:id="@+id/RightFormulaHeader"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="right"
    android:textSize="@dimen/text_huge"
    android:text="&gt;"/>
  </RelativeLayout>
</RelativeLayout>
</LinearLayout>


  <ListView
  android:id="@+id/TheList"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:background="#000033"
  android:layout_weight="1"
  android:drawSelectorOnTop="false" />

  <TextView
      android:id="@+id/empty_list_item"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:visibility="gone"
      android:text="@string/empty_list" />
</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-06-18T05:13:17+00:00Added an answer on June 18, 2026 at 5:13 am

    Your main issue: gravity affects positioning of the text within the TextView. You want alignParentLeft/-Right and centerHorizontal for what you are doing (although gravity="center" remains to keep the header centered in its view).

    <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    
    <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentLeft="true"
      android:textSize="@dimen/text_huge"
      android:id="@+id/LeftFormulaHeader"
      android:text="&lt;"/>
    <TextView
      android:layout_width="200dip"
      android:layout_height="wrap_content"
      android:textSize="@dimen/text_huge"
      android:ellipsize="end"
      android:scrollHorizontally="false"
      android:singleLine="true"
      android:layout_centerHorizontal="true"
      android:gravity="center"
      android:id="@+id/FormulaHeader"
      android:text="HEADER"/>
    
    <TextView
    android:id="@+id/RightFormulaHeader"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:textSize="@dimen/text_huge"
    android:text="&gt;"/>
    </RelativeLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems to be a very simple problem but I have searched and I
I'm sure that this is a very simple problem, but I have multiple pages
I have a very simple problem but cannot find a nice solution. I have
I have a very simple problem, but I can't seem to solve it. I
very simple problem, but i want to see how experts look at it. This
I have a very simple problem for which though I have a solution but
Probably a very simple problem and I have been looking for the answer but
This might be a very simple problem indeed, but I am absolutely new to
I'm aware this is probably a very simple problem with a 1-line-of-code answer but
I am new to this portal. I have a very simple problem to be

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.