我有許多頁面,其內容大於屏幕,即用戶必須向下滾動以查看更多內容。這些頁面在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) –