我有许多页面,其内容大于屏幕,即用户必须向下滚动以查看更多内容。这些页面在ViewPager中。对于我的生活,我无法弄清楚如何进行垂直滚动工作。垂直滚动和在ViewPager中水平分页
只是要清楚,我不想垂直页面到另一个页面,只需向下滚动一页即可。
我希望有人能指出我正确的方向。搜索不会产生任何结果,但如果这不是一件常见的事情,我会感到惊讶。
我已经试过:
- 缠绕保存视图寻呼机及其他意见的线性布局的滚动视图。
- 布局和布局参数的不同组合。
感谢
按照建议,我已经采取了从AndroidHive的例子,所以我的片段XML如下,它有足够的内容,它不适合屏幕。所以我希望能够向下滚动类似于列表视图来查看其余内容。
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context="info.androidhive.materialtabs.fragments.OneFragment">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/one"
android:textSize="40dp"
android:textStyle="bold" />
<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/text"
android:text="@string/one"
android:textSize="40dp"
android:textStyle="bold" />
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/text1"
android:text="@string/one"
android:textSize="40dp"
android:textStyle="bold" />
<TextView
android:id="@+id/text3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/text2"
android:text="@string/one"
android:textSize="40dp"
android:textStyle="bold" />
<TextView
android:id="@+id/text4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/text3"
android:text="@string/one"
android:textSize="40dp"
android:textStyle="bold" />
<TextView
android:id="@+id/text5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/text4"
android:text="@string/one"
android:textSize="40dp"
android:textStyle="bold" />
<TextView
android:id="@+id/text6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/text5"
android:text="@string/one"
android:textSize="40dp"
android:textStyle="bold" />
<TextView
android:id="@+id/text7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/text6"
android:text="@string/one"
android:textSize="40dp"
android:textStyle="bold" />
<TextView
android:id="@+id/text8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/text7"
android:text="@string/one"
android:textSize="40dp"
android:textStyle="bold" />
<TextView
android:id="@+id/text9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/text8"
android:text="@string/one"
android:textSize="40dp"
android:textStyle="bold" />
<TextView
android:id="@+id/text10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/text9"
android:text="@string/one"
android:textSize="40dp"
android:textStyle="bold" />
</RelativeLayout>
</ScrollView>
我还没有从示例代码中改变任何东西。
您的滚动查看标记未关闭。 –
对不起,它被错误地复制,它实际上正确关闭 – WolfBane
相对布局安排视图组彼此相对。 您可以将文本排列在其他文本视图的左侧 在您的示例中,一个简单的解决方案将使用线性布局。因此,每个文本视图排列在彼此的底部 [阅读更多](http://androidexample。com/Relative_Layout_Basics _-_ Android_Example/index.php?view = article_discription&aid = 73) –