【问题标题】:Android ListView locks its current screen and doesnt scroll when phone is rotated only the item before rotation is visibleAndroid ListView锁定其当前屏幕并且在手机旋转时不滚动仅旋转之前的项目可见
【发布时间】:2015-01-26 22:28:40
【问题描述】:
大家好,我遇到了一个非常烦人的问题,它占用了我的时间,这可能很简单,但我需要你的帮助。我尝试了几乎所有的方法,但都没有奏效。
<activity
android:name="activities.UserMainActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/title_activity_user_main" >
并尝试编写 configChanges 并且不编写甚至将我的自定义类更改为 parcellable 但没有结果。并且没有抛出异常。
当我调试并观看自定义适配器时,它会填充近 30 条记录的所有项目。任何帮助都将受到赞赏
【问题讨论】:
标签:
android
android-activity
android-listview
rotation
android-adapter
【解决方案1】:
天哪,这是一个极其简单的细节。我刚刚编辑了我的活动布局。我在 Relative Layout 中有我的 ListView 而这个 Relative Layout 在 ScrollView 中,删除这个 ScrollView 解决了我的问题耗天问题。但是,如果我删除 android:configChanges="keyboardHidden|orientation|screenSize" 部分 ListView 效果很好,但在旋转时会滚动回顶部(提示)。
<--<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ListView
android:id="@+id/listQuestion"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
</RelativeLayout>
<!-- </ScrollView> -->