android - 在 ListView 之后滑动 Activity

标签 android listview android-viewpager

首先,对于糟糕的问题标题感到抱歉。

我有一个自定义 ListView,其中包含从 xml 文件解析的问题。单击其中一个问题后,将开始一项新 Activity ,可以回答问题。这些问题有不同类型的答案,如开放式文本、多项选择、 slider ……每种答案类型都有一个 Activity 。 回答完问题后,用户按下确定按钮并返回到 ListView。

到目前为止这有效

但是,我想添加滑动。用户在 ListView 中单击一个问题,回答它并可以滑动到下一个或之前的问题。

实现它的最佳方法是什么? 保留我的回答 Activity 并使用手势检测器在它们之间切换? 将我的回答 Activity 转换为 fragment 并使用 ViewPager?

编辑:一个大问题可能是问题和答案类型( Activity )总是不同的,而不是静态的。

最佳答案

为什么不创建要使用的 Intents 的 ArrayList 并根据这些 Intent 调用 Activity,在填充 ListView 时将 Intent 添加到 ArrayList

关于android - 在 ListView 之后滑动 Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10624083/

相关文章:

android - 如何在本地删除文档以便服务器在 couches 服务器中保留副本

android - 树解析器与流解析器

android - 循环 FragmentPagerAdapter

android - Fragment 内的 ViewPager 不会恢复子 fragment 的状态

android - Phonegap 3 (apache cordova) getpicture 错误(无法读取属性 'PictureSourceType' 和 DATA_URL

android - 拼写建议为 android.text.TextWatcher 提供冗余值

android - 如果 ListView 中没有项目,ListView.addFooterView() 不工作

android - 如何从 AlertDialog 中由光标填充的 ListView 获取选中的值?

c# - 在 C# 中按多列对 ListView 进行排序

Android TabLayout 选中的tab背景