Android ApiDemos示例解析(189):Views->ScrollBars->2.Fancy

ScrollView 的滾動條背景和滑塊可以定制,本例使用drawable 為ScrollView定制瞭滾動條和滑塊,滾動條寬度設為12dip ,滑塊為藍色等

<ScrollView xmlns:android=”http://schemas.android.com/apk/res/android”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:scrollbarTrackVertical=”@drawable/scrollbar_vertical_track”
android:scrollbarThumbVertical=”@drawable/scrollbar_vertical_thumb”
android:scrollbarSize=”12dip”>

<LinearLayout
android:orientation=”vertical”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”>

<TextView
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/scrollbar_2_text”/>

<TextView
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/scrollbar_2_text”/>
</LinearLayout>
</ScrollView>

 

You May Also Like