ScrollBy has no effect.

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

ScrollBy has no effect.

Postby metter » Tue Jun 02, 2009 12:43 pm

Hello.

I have a ScrollView containing a LinearView. The LinearView contains a lot of TwoLineListItems.

I want this list to be scrolled to the end when i start the activity. For this, I use scrollView.scrollBy(0, 1000000); after i have set up the screen and added all views. This has no effect whatsoever though :(.

The fun thing is, if I call scrollView.scrollBy(0, 1000000) later (when dynamically adding a new TwoLineListItem), it works. :?: :?:

Why doesn't this work form the beginning?

Thank you.

Cheers.
metter
Junior Developer
Junior Developer
 
Posts: 16
Joined: Tue Jan 06, 2009 2:00 pm

Top

Postby metter » Sat Jun 20, 2009 10:33 am

Anyone? I still wasn't able to resolve the issue :(
metter
Junior Developer
Junior Developer
 
Posts: 16
Joined: Tue Jan 06, 2009 2:00 pm

Postby metter » Sat Jun 20, 2009 10:51 am

Ok, as usual. You spend hours and hours and as soon as you ask, you figure it out :)


For anyone with the same problem:

scrollBy must be called after onWindowFocusChanged (Or at least it works like this...).


public void onWindowFocusChanged(boolean hasFocus) {
if(hasFocus)
scrollView.scrollBy(0, 1000000);
}


Cheers
metter
Junior Developer
Junior Developer
 
Posts: 16
Joined: Tue Jan 06, 2009 2:00 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 8 guests