0
我有一个ScrollView的小问题。我有一个用ScrollView制作的活动的布局。这个滚动视图包含两个ListViews。如何以编程方式滚动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>
在我的活动的onCreate
方法我计算根据其内容列表视图高度。
在执行期间,在活动启动时,ScrollView已经滚动了一下。
所以我试了一下,在onCreate的最后调用方法scrollTo(0, 0)
,但它并没有改变任何东西。
任何想法?
有一个非常好的例子,你可以弯曲和做出真正的弯曲 通过Jeff Sharkey http://jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android- 09 / – 2010-01-08 17:37:24