我对ScrollView有一点问题.我有一个用ScrollView制作的活动布局.此滚动视图包含两个ListView.
<?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>
Run Code Online (Sandbox Code Playgroud)
在onCreate我的活动方法中,我根据内容计算ListViews高度.
在执行期间,在活动启动时,ScrollView已经滚动了一点.
所以我尝试在onCreate结束时调用方法scrollTo(0, 0),但它没有改变任何东西.
有任何想法吗?
AHHH!删除ScrollView并在您的活动中只保留一个ListView.它不打算以这种方式工作.如果你想有不同的内容在您的ONE的ListView -修改您的适配器,或更改UI但永远不会把同一个屏幕上不同的滚动容器/内部彼此这里是一个相关的帖子. http://groups.google.com/group/android-developers/browse_thread/thread/e7c8df374fe31733# 从理论上讲,你可以在屏幕上一巴掌2名列表视图,但想到事情会很奇怪.我真的会使用分隔符或扩展器或只使用一个ListView重新设计它.
| 归档时间: |
|
| 查看次数: |
2366 次 |
| 最近记录: |