I have made an android activity in that i have put a scrollView,Now i want that when i open the activity,It should alreay scrolled up to 20% ,But it should be scrolled down after that,I have tried so many links and refrences for that,But i am failed to do that,Can anyone please help me how can i do it,My xml code is as below for scrollview,I have put image,I want scrollview show already scrolled to some fixed height on startup of activity.
main.xml
<ScrollView
android:id="@+id/scr_profile"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:scrollY="200dp"
android:scrollbars="none" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
......
</ScrollView>
Have you try Runnable?
final ScrollView scroll = (ScrollView) this.findViewById(R.id.scr_profile);
scroll.post(new Runnable() {
@Override
public void run() {
scroll.scrollTo(200, 200);
}
});
this does work for me.