ScrollView에 약간의 문제가 있습니다. ScrollView로 만든 활동을위한 레이아웃이 있습니다. 이 scrollview는 두 개의 ListView를 포함합니다. 내 활동의 onCreate
방법에서 프로그래밍 방식으로 ScrollView를 스크롤하는 방법은 무엇입니까?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rootViewGroup" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:scrollbars="vertical">
<LinearLayout android:orientation="vertical"
android:gravity="top" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="@drawable/cmb_bg">
<ListView android:id="@+id/accountsListView"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:scrollbars="none" />
<ListView android:id="@+id/cardsListView"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:scrollbars="none" />
</LinearLayout>
나는 그 내용을 따라의 ListView의 높이를 계산한다.
실행 중에 활동을 시작하면 ScrollView가 이미 약간 스크롤됩니다.
그래서 내가 시도한 끝에 메서드 scrollTo(0, 0)
을 호출하기 위해 onCreate를 시도했지만 아무 것도 변경하지 않았습니다.
아이디어가 있으십니까?
제프 샤키 (Jeff Sharkey)가 구부리거나 굽힐 수있는 아주 좋은 예가 있습니다 http://jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android- 09 / –