天天看點

安卓開發之ScrollView

當界面不足以将所有的内容顯示出來的時候便導緻下面的部分内容無法顯示出來

所有加上ScrollView 來講要顯示的内容放入之中便可以實作上下滾動界面内容

但是當要顯示多個控件的時候會出錯  原因是ScrollView隻能有一個子控件  解決方法就是 用一個LinearLayout(或者别的布局)來嵌套所有的控件

xml代碼如下:

<ScrollView 
		android:id="@+id/ScrollView"
		android:layout_width="fill_parent" 
		android:layout_height="wrap_content" 
		android:scrollbars="vertical"> 
		<LinearLayout
		    android:layout_width="match_parent"
		    android:layout_height="fill_parent"
		    android:orientation="vertical" >
		  -------------這裡添加任意個控件----------		 
                                 </LinearLayout>
		
	                 </ScrollView>
      

繼續閱讀