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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:13:48+00:00 2026-05-31T17:13:48+00:00

Width + wrap_content works fine with other single line TextViews within my layout. However

  • 0

Width + wrap_content works fine with other single line TextViews within my layout. However my multiline TextViews will neither shrink or grow to adapt to the numbers within it. Ideally I would like the view to wrap both it’s height and width to fit the content within it.

The TextViews 1-10 (the textViews positioned at the top of each button) are single lined and work just as I want them to. They expand and shrink based on their size (wrap to content works as it should).

The TextViews 11-20 are fixed in size and will not shrink or expand despite having identical code other than being multilined. (they use \n within their strings). They should consist of two numbers between 0 and 100 positioned vertically.

Interface

enter image description here

<?xml version="1.0" encoding="utf-8"?>

            <TextView android:id="@+id/textView1" android:layout_alignLeft="@+id/imageButton1" android:background="#000000" android:layout_width="wrap_content" android:text="0/0/0" android:layout_below="@+id/imageButton1" android:textAppearance="?android:attr/textAppearanceSmall" android:visibility="invisible" android:layout_height="wrap_content"></TextView>
    <TextView android:id="@+id/textView5" android:layout_alignLeft="@+id/imageButton5" android:background="#000000" android:layout_width="wrap_content" android:text="0/0/0" android:layout_above="@+id/imageButton5" android:textAppearance="?android:attr/textAppearanceSmall" android:visibility="invisible" android:layout_height="wrap_content"></TextView>
    <TextView android:id="@+id/textView7" android:background="#000000" android:layout_width="wrap_content" android:text="0/0/0" android:layout_above="@+id/imageButton7" android:textAppearance="?android:attr/textAppearanceSmall" android:visibility="invisible" android:layout_height="wrap_content" android:layout_alignParentLeft="true"></TextView>
    <TextView android:id="@+id/textView8" android:layout_alignBottom="@+id/textView3" android:background="#000000" android:layout_width="wrap_content" android:text="0/0/0" android:textAppearance="?android:attr/textAppearanceSmall" android:visibility="invisible" android:layout_height="wrap_content" android:layout_alignParentLeft="true"></TextView>
    <TextView android:id="@+id/textView9" android:background="#000000" android:layout_width="wrap_content" android:text="0/0/0" android:layout_below="@+id/imageButton9" android:textAppearance="?android:attr/textAppearanceSmall" android:visibility="invisible" android:layout_height="wrap_content" android:layout_alignParentLeft="true"></TextView>
    <TextView android:id="@+id/textView10" android:layout_alignLeft="@+id/imageButton10" android:background="#000000" android:layout_width="wrap_content" android:text="0/0/0" android:layout_below="@+id/imageButton10" android:textAppearance="?android:attr/textAppearanceSmall" android:visibility="invisible" android:layout_height="wrap_content"></TextView>
    <TextView android:id="@+id/textView6" android:layout_alignBottom="@+id/textView7" android:layout_alignLeft="@+id/imageButton6" android:background="#000000" android:layout_width="wrap_content" android:layout_alignBaseline="@+id/textView7" android:text="0/0/0" android:visibility="invisible" android:layout_height="wrap_content"></TextView>
    <TextView android:id="@+id/textView4" android:layout_alignBottom="@+id/textView5" android:layout_alignLeft="@+id/imageButton4" android:background="#000000" android:layout_width="wrap_content" android:layout_alignBaseline="@+id/textView5" android:text="0/0/0" android:visibility="invisible" android:layout_height="wrap_content" android:layout_marginLeft="-10dp"></TextView>
    <TextView android:id="@+id/textView3" android:layout_alignLeft="@+id/imageButton3" android:background="#000000" android:layout_width="wrap_content" android:text="0/0/0" android:layout_above="@+id/imageButton3" android:textAppearance="?android:attr/textAppearanceSmall" android:visibility="invisible" android:layout_height="wrap_content" android:layout_marginLeft="-10dp"></TextView>
    <TextView android:id="@+id/textView2" android:layout_alignBottom="@+id/textView1" android:layout_alignLeft="@+id/imageButton2" android:background="#000000" android:layout_width="wrap_content" android:layout_alignBaseline="@+id/textView1" android:text="0/0/0" android:textAppearance="?android:attr/textAppearanceSmall" android:visibility="invisible" android:layout_height="wrap_content" android:layout_marginLeft="-10dp"></TextView>


    <TextView android:id="@+id/textView11" android:visibility="invisible" android:background="#000000" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_toLeftOf="@+id/imageButton1" android:layout_toRightOf="@+id/nextHandButton" android:layout_above="@+id/textView1"></TextView>
    <TextView android:id="@+id/textView12" android:visibility="invisible" android:background="#000000" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_toLeftOf="@+id/imageButton2" android:layout_above="@+id/textView2" android:layout_alignLeft="@+id/textView2"></TextView>
    <TextView android:id="@+id/textView13" android:visibility="invisible" android:background="#000000" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignTop="@+id/imageButton3" android:layout_alignRight="@+id/textView12" android:layout_above="@+id/imageView4" android:layout_alignLeft="@+id/textView3"></TextView>
    <TextView android:id="@+id/textView14" android:visibility="invisible" android:background="#000000" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentBottom="true" android:layout_alignLeft="@+id/textView4" android:layout_alignTop="@+id/imageButton4" android:layout_toLeftOf="@+id/imageButton4"></TextView>
    <TextView android:id="@+id/textView15" android:visibility="invisible" android:background="#000000" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_below="@+id/textView5" android:layout_toLeftOf="@+id/imageButton5" android:layout_alignParentBottom="true" android:layout_alignLeft="@+id/textView11"></TextView>
    <TextView android:id="@+id/textView16" android:visibility="invisible" android:background="#000000" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignTop="@+id/imageButton6" android:layout_alignLeft="@+id/imageView6" android:layout_alignParentBottom="true" android:layout_toLeftOf="@+id/nextHandButton"></TextView>
    <TextView android:id="@+id/textView17" android:visibility="invisible" android:background="#000000" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignTop="@+id/imageButton7" android:layout_toRightOf="@+id/imageButton7" android:layout_alignParentBottom="true" android:layout_toLeftOf="@+id/textView6" android:layout_marginRight="50dp"></TextView>
    <TextView android:id="@+id/textView18" android:visibility="invisible" android:background="#000000" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_below="@+id/textView8" android:layout_toRightOf="@+id/imageButton8" android:layout_alignBottom="@+id/imageView7" android:layout_alignRight="@+id/textView17" android:maxLines="2"></TextView>
    <TextView android:id="@+id/textView19" android:visibility="invisible" android:background="#000000" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_toRightOf="@+id/imageButton9" android:layout_alignBottom="@+id/imageButton9" android:layout_alignRight="@+id/textView18"></TextView>
    <TextView android:id="@+id/textView20" android:visibility="invisible" android:background="#000000" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_alignLeft="@+id/imageView10" android:layout_alignBottom="@+id/imageButton10" android:layout_alignRight="@+id/textView16" android:layout_height="wrap_content" android:maxLines="2"></TextView>
</RelativeLayout>

  • 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-31T17:13:50+00:00Added an answer on May 31, 2026 at 5:13 pm

    What happened here was a consequence of using eclipses drag and drop graphical layout with androids relative layout rather than typing the relative constraints myself. There were unecessary constraints in place such as:

    android:layout_alignRight="@+id/textView18"
    

    The above constraint would stop the view from expanding to the right. These constraints were stopping the width or height wrap content properties from taking effect. If your facing a similar problem have a good look through your code for relative layout constraints that may be overriding your Views ability to expand or shrink in the direction you want it to.

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

Sidebar

Related Questions

Following is my layout file. It works fine except that when I include both
I'm using a custom notification layout in my app. It works fine in all
I am trying to create custom background selector for my ExpandableListView. It works fine
So, i'm trying to start activity by sweeping across the screen, it works fine
I'm running my code on the emulator with Android 2.2 and it works fine.
Using my onEditTextchanger. It works fine when the user inputs 100000, in the EditText
Problem: My app works fine on most devices, but crashes on HTC Desire HD
I have made a popup, which works fine, but I'd like to write to
I have a content slider script that works fine for me in FF, IE
I have created a custom class from a tutorial online. It works fine, but

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.