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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:56:01+00:00 2026-06-03T22:56:01+00:00

I have an activity with two Buttons and a TextView in a LinearLayout. My

  • 0

I have an activity with two Buttons and a TextView in a LinearLayout. My TextView is offset downwards and the text doesn’t fit inside the box. Can you explain what is happening? I think it is related to padding, and I’ve read several discussions about the perils of TextView padding, but that doesn’t explain why the text is cut off at the bottom.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:background="#800080">

    <Button
        android:text="This"
        android:background="@drawable/button_red" 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
    />
    <Button
        android:text="That"
        android:background="@drawable/button_green" 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
    />
    <TextView 
        android:text="Copious amounts of text that overflows onto several lines on a small screen, causing the TextView to dangle below the buttons.  Why it does this I can't imagine.  I only hope someone can help me with this." 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#533f93"
    />
</LinearLayout>

This code produces this display:

User interface

The purple is the LinearLayout, the blue is the TextView. As you can see, the TextView’s top is below those of the buttons and its bottom is below the bottom of the LinearLayout. As I add text to the TextView, the LinearLayout increases its height appropriately, but because the TextView is offset, I always lose the bottom of the last line.

I ran Hierarchy Viewer and it gave me this wireframe:

Wireframe image from Hierarchy Viewer

Which shows the vertical offset at the top, but misses the bottom of the TextView. The same wireframe with the LinearLayout selected looks like this:

Wireframe image from Hierarchy Viewer - LinearLayout selected

According to Hierarchy Viewer, the top of the buttons is at 0, but the top of the TextView is at 7. I’ve tried various fixes, mostly culled from this site:

    android:paddingTop="0dp"
    android:background="@null"
    android:includeFontPadding="false"

None of these fixed my issue.

  • 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-03T22:56:03+00:00Added an answer on June 3, 2026 at 10:56 pm

    Set android:baselineAligned property of your LinearLayout to false.

    From documentation:

    When set to false, prevents the layout from aligning its children’s
    baselines. This attribute is particularly useful when the children use
    different values for gravity. The default value is true.

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

Sidebar

Related Questions

I have an activity with two buttons, start and stop. If the user press
What I have here real simple activity with two buttons. When you press each
I have a activity,my activity contains ImageView and two buttons.I have assign drawable animation
i have three classess.activity,service and appwidget. i have two buttons in appwidget. and onclicking
I have an activity which uses two Loaders. Each of them returns different type
I have an activity which needs to make two remote server calls. The first
I have a activity where I have two imageViews. In onTouch I recognize which
I have a activity where I have two imagesViews. This to imagesViews has onClickListener,
I have a launcher activity which contains two tabs which corresponds to two separate
I have an Activity in Android, with two elements: EditText ListView When my Activity

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.