2011-06-24 194 views
0

這裏後滾動是我的佈局:滾動型不添加內容動態

<LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical"> 
    <ScrollView 
      android:id="@+id/button_scroll" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_horizontal" 
      android:fillViewport="true"> 
     <LinearLayout 
       android:id="@+id/buttons" 
       android:orientation="horizontal" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:gravity="center_horizontal"/> 
    </ScrollView> 
</LinearLayout> 

在我的代碼,我加入按鈕到水平的LinearLayout ID /按鈕。一切都很順利,只是在添加了足夠的內容後,它從不滾動。

我想:

  • 呼叫了滾動
  • 更改爲無效的LinearLayout中的layout_width嘗試使用Horizo​​ntalScrollView爲wrap_content

回答

2

! ScrollView佈局只能垂直滾動,正如我幾周前發現的那樣嘗試同樣的事情!

+1

啊啊啊,這麼簡單...謝謝! – Matthieu