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

The Archive Base Latest Questions

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

I have a ScrollView with a LinearLayout inside an I’m adding TextViews. But I

  • 0

I have a ScrollView with a LinearLayout inside an I’m adding TextViews. But I always want the last added TextView to be visible, so I need the ScrollView to scroll to the Bottom, when a TextView is added. I don’t know why, but when I call scrollto(), scrollby() or fullScroll() after adding a textview, it only scrolls to the textview before the last one.

Do you know a better way to do this?

Thanks a lot!

Code:

I got a Button, which calls this function:

private void addRound() {
    // TODO Auto-generated method stub
    TextView newRound = new TextView(Stopwatch.this);
    newRound.setText("" + counter + ". - " + timerText());
    newRound.setTextSize(20);
    newRound.setGravity(Gravity.CENTER);
    linlay.addView(newRound);
    counter++;
}

After calling this function I call fullScroll().

addRound();
sv.fullScroll(View.FOCUS_DOWN);

sv ist my ScrollView, linlay is the linearlayout inside the scrollview.

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

    I reckon it’s because the ScrollView is not quite updated by the time you call sv.scrollFull(View.FOCUS_DOWN); Try the following (to replace your second code sample):

    addRound();
    sv.post(new Runnable() {
    
       @Override
       public void run() {
         sv.fullScroll(View.FOCUS_DOWN);
       }
    });
    

    If the above doesn’t work, try the following (it’s not an elegant way of doing it but it may work):

    addRound();
    sv.postDelayed(new Runnable() {
    
       @Override
       public void run() {
         sv.fullScroll(View.FOCUS_DOWN);
       }
    }, 100);
    

    Hope this works!

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

Sidebar

Related Questions

I have the following layout structure: ScrollView - LinearLayout - TextView - ImageView -
i have a textview and imageview inside a linearlayout. textview containes more text so
I have a GridView inside of a LinearLayout inside of a ScrollView that pages
I have a scrollview control that has a StackPanel (Orientation=Vertical) UI Element inside of
In my .xml file i have this format: <LinearLayout android:layout_orientation=vertical...> <ImageView>... </ImageView> <ScrollView ...>
Im confused. I have a layout (LinearLayout) holding a TextView and EditText. Somewhere in
I am having trouble with a scrolling ListView inside a ScrollView . I have
I have the following problem spanning dynamically added rows to a TableLayout inside a
I have a LinearLayout , containg a ScrollView of ViewFlipper layouts. I've only included
I really only need my ScrollView wrapped around 1 of the 3 LinearLayout s

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.