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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:52:43+00:00 2026-06-04T08:52:43+00:00

I have to build layout like at the picture below. The main task is

  • 0

I have to build layout like at the picture below.
The main task is to center the text.

enter image description here

I use this xml for implementing layout.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main_layout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/ll"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center_vertical"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/author"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/author">
    </LinearLayout>

    <LinearLayout
        android:id="@+id/footer_layout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="bottom"
        android:orientation="vertical" 
        android:layout_alignParentBottom="true">

        <LinearLayout
            android:id="@+id/menu_layout"
            android:layout_width="fill_parent"
            android:layout_height="60dp"
            android:background="@drawable/nav_overlay"
            android:gravity="center_horizontal"
            android:orientation="horizontal">

            <Button
                android:id="@+id/previous"
                android:layout_width="45dp"
                android:layout_height="45dp"
                android:background="@drawable/button" />

        </LinearLayout>

        <com.google.ads.AdView
            xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
            android:id="@+id/adView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            ads:adSize="BANNER"
            ads:adUnitId="@string/admob_id"
            ads:loadAdOnCreate="true" />
    </LinearLayout>

</RelativeLayout>

But it works incorrectly.

I need to center TextView android:id="@+id/author" inside LinearLayout android:id="@+id/ll". But it is centered in the parent RelativeLayout android:id="@+id/main_layout".
I use android:layout_height="fill_parent" for LinearLayout android:id="@+id/ll".
How can my Layout fill not the parent but only remaining space?
Give an example of its implementation, if anyone come to similar issue.

EDIT: Now I have wrong centered text like at the picture below now.
enter image description here

At this moment, I think the best solution is to use android:layout_weight.
But when the ads are not shown – the proportions are violated.

  • 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-04T08:52:44+00:00Added an answer on June 4, 2026 at 8:52 am

    Try now:

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main_layout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    
    <LinearLayout
        android:id="@+id/ll"
        android:layout_above="@+id/footer_layout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center_vertical"
        android:orientation="vertical" >
    
        <TextView
            android:id="@+id/author"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/author"/>
    </LinearLayout>
    
    <LinearLayout
        android:id="@+id/footer_layout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="bottom"
        android:orientation="vertical" 
        android:layout_alignParentBottom="true">
    
        <LinearLayout
            android:id="@+id/menu_layout"
            android:layout_width="fill_parent"
            android:layout_height="60dp"
            android:background="@drawable/nav_overlay"
            android:gravity="center_horizontal"
            android:orientation="horizontal">
    
            <Button
                android:id="@+id/previous"
                android:layout_width="45dp"
                android:layout_height="45dp"
                android:background="@drawable/button" />
    
        </LinearLayout>
    
        <com.google.ads.AdView
            xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
            android:id="@+id/adView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            ads:adSize="BANNER"
            ads:adUnitId="@string/admob_id"
            ads:loadAdOnCreate="true" />
    </LinearLayout>
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my layout xml file I have several buttons like this which share the
in my app i have activity with XML layout, i want to build an
I'm trying to build a page which will have a box-like layout..A top banner
I have been using the Twitter Bootstrap to build the base layout for a
I'm trying to build the simple layout that I have got in the image
I am trying to build a site using elastic layout. I have used Eric
I have build a c# class library verification.dll using OpenCVSharp. This references OpenCvSharp.dll in
I am trying to build a layout dynamically which display some text and image
I'm trying to build an archetype structure like this, a webapp with some custom
I have a parsing system for fixed-length text records based on a layout table:

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.