2012-10-01 33 views
0

我對Android完全陌生,我的第一個嘗試是使用LinearLayout來定位多個控件,但是我的模擬器屏幕並不是那麼大以包含我的所有控件,而且輸出不顯示所有控件並且沒有自動添加垂直滾動條。 我應該怎麼做才能讓它們都可見?在Android視圖中的自動滾動條

<LinearLayout> 
<control_1/> 
<control_2/> 
///////... 
<control_n/> 
</LinearLayout> 

回答

1

您需要將您的佈局包裝在ScrollView中。您的代碼如下所示:

<ScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <LinearLayout 
     android:id="@+id/linearLayout1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 

     <!-- put your controls in here --> 

    </LinearLayout> 
</ScrollView>