2012-01-30 57 views
3

如何在android xml文件中添加滾動條??? 任何人都可以使用簡單的方式將其添加到相對佈局中。 我曾多次嘗試將它添加到相對和線性佈局中。 但是,它不起作用。 請給我解決方案。android中的滾動條

謝謝。

回答

3

參考上面的回答:

如何使用相對佈局W.R.T. SCROLLVIEW

<ScrollView 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/scrollView1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 


    <RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" >   
    ... ... ... 

</RelativeLayout> 
</ScrollView> 
3

將您的相對或線性佈局包裝在ScrollView中。例如:

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

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 

     <!-- contents of linear layout go here --> 
    </LinearLayout> 
</ScrollView>