ScrollView隱藏、調整大小


ScrollView有很多屬性管理它的樣式,如果在xml中設置,可以在<ScrollView >標簽內設置滾動條樣式的屬性: 
• android:scrollbars="none",不顯示滾動條,但能夠滾動的; 
• android:scrollbarSize,滾動條大小。 
修改上面的例子添加這些屬性xml布局文件代碼如下: 

Java代碼 
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"  
  3.     android:layout_width="match_parent"  
  4.     android:layout_height="wrap_content"  
  5.     android:scrollbarSize="12dip"  
  6.     android:scrollbars="none"  
  7.     >  
  8.     <LinearLayout android:orientation="vertical"  
  9.         android:layout_width="fill_parent" android:layout_height="fill_parent">  
  10.         <TextView android:layout_width="fill_parent"  
  11.             android:layout_height="wrap_content" android:text="@string/hello"  
  12.             android:textSize="20dip" />  
  13.         <TextView android:layout_width="fill_parent"  
  14.             android:layout_height="wrap_content" android:text="@string/content" />  
  15.     </LinearLayout>  
  16. </ScrollView>  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM