2014-04-23 30 views
0

我在我的android項目中使用Xml文件中的滾動視圖。用戶必須在運行時拖放元素。 最初它有零元素。我已經調整了它的高度,以便一次顯示2個元素。android xml scrollview顯示滾動條,甚至沒有任何元素...爲什麼?

現在我想要的是,當它的元素數爲0,1,2;它不應該顯示任何滾動條,只有當元素數量超過2時纔會出現滾動條。

我該怎麼做?

+0

發表您的佈局文件。我認爲你在佈局上有錯誤。 –

回答

0

您可以使用它來自動調整您的滾動視圖與您的佈局項目。

<ScrollView 

    android:layout_width="fill_parent" 
    android:layout_height="match_parent" > 
    <LinearLayout 

     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical" > 
    Use your contents here 
    </LinearLayout> 

相關問題