簡體   English   中英

滾動視圖不起作用

[英]Scroll view does not work

我有一個滾動視圖,可以動態填充代碼。 我希望如果我在parant視圖中放置太多內容,該視圖將變為可滾動的。 這是行不通的。

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true">

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_centerHorizontal="true"
            android:id="@+id/layoutScoreBoardHeader"
            android:layout_marginTop="15dp">

        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/layoutScoreBoard"
            android:orientation="horizontal"
            android:layout_centerHorizontal="true"
            android:layout_below="@id/layoutScoreBoardHeader">

        </LinearLayout>

    </RelativeLayout>
</ScrollView>

布局結構不良。 RelativeLayout應該wrap_content。 在您的情況下,其大小將與初始ScrollView相同,並且將忽略子級大小。

我有 不知道有沒有類似水平滾動視圖的特殊視圖。 但是謝謝你們的反饋!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM