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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:59:32+00:00 2026-05-29T07:59:32+00:00

I want to reset a textView height after I have added it to the

  • 0

I want to reset a textView height after I have added it to the main window in the xml file.

inside a RelativeLayout,

  <TextView
      android:id="@+id/text_l"
      android:layout_width="50sp"
      android:layout_height="50sp"
      android:layout_alignParentTop="true"
      android:layout_centerHorizontal="true"
      android:layout_marginLeft="10sp"
      android:layout_marginTop="145dp"
      android:gravity="center"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:textColor="#000000" >
  </TextView>

I just want to change it from 50 to 70:

I tried:

 TextView text = (TextView)findViewById(R.id.text_l);
 text.setHeight(70);

but nothing changed.

  • 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-29T07:59:33+00:00Added an answer on May 29, 2026 at 7:59 am

    You should change it via LayoutParams:

    LayoutParams params = (LayoutParams) textView.getLayoutParams();
    params.height = 70;
    textView.setLayoutParams(params);
    

    EDIT

    You should not use sizes in pixels in you code, use dimensions for this:

    dimens.xml:

    <dimen name="text_view_height">50dp</dimen>
    

    In code:

    params.height = getResources().getDimensionPixelSize(R.dimen.text_view_height);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a RelativeLayout with the xml something like: <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android
I have an ImageView in my xml file, i want to rotate the image
I want to reset a file upload field when the user selects another option.
I have multiple input textboxes in my page. I want to reset particular text
I am implementing a password reset function and would have the key I want
How do I reset my numbers after they count? I want something like an
I have multiple comment ids I want to reset to a default value. Ex:
I have two radio buttons and I want to reset all the validation of
I have the following TextView: <TextView android:id=@+id/theFooBar android:autoLink=web android:layout_height=wrap_content android:layout_width=fill_parent android:text=@string/fooBar android:textColor=@android:color/black android:textSize=20sp/> And
I have a working android app using TextView, some formatting (line breaks, rows of

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.