1. Activity_maim.xml[HTML]View Plaincopy
- <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical" >
- <ScrollView
- android:id="@+id/view1"
- android:layout_width="100dip"
- android:layout_height="120dip"
- android:background="@android: Color/white"
- android:padding="8dip"
- android:scrollbarstyle="Insideoverlay" >
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@android: Color/darker_gray"
- android:text="scroll_text scroll_text scroll_text scroll _text Scroll_text scroll_text scroll_text "
- android:textcolor="#ffffff" />
- </ScrollView>
- <ScrollView
- android:id="@+id/view2"
- android:layout_width="100dip"
- android:layout_height="120dip"
- android:background="@android: Color/white"
- android:padding="8dip"
- android:scrollbarstyle="Insideinset" >
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@android: Color/darker_gray"
- android:text="scroll_text scroll_text scroll_text scroll _text Scroll_text scroll_text scroll_text "
- android:textcolor="#ffffff" />
- </ScrollView>
- <ScrollView
- android:id="@+id/view3"
- android:layout_width="100dip"
- android:layout_height="120dip"
- android:background="@android: Color/white"
- android:padding="8dip"
- android:scrollbarstyle="Outsideoverlay" >
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@android: Color/darker_gray"
- android:text="scroll_text scroll_text scroll_text scroll _text Scroll_text scroll_text scroll_text "
- android:textcolor="#ffffff" />
- </ScrollView>
- <ScrollView
- android:id="@+id/view4"
- android:layout_width="100dip"
- android:layout_height="120dip"
- android:background="@android: Color/white"
- android:padding="8dip"
- android:scrollbarstyle="Outsideinset" >
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@android: Color/darker_gray"
- android:text="scroll_text scroll_text scroll_text scroll _text Scroll_text scroll_text scroll_text "
- android:textcolor="#ffffff" />
- </ScrollView>
- </linearlayout>
2. Operation Result:Insideinset, Insideoverlay, Outsideinset, OutsideoverlayCorresponding to the left explanation respectively!
3.android:scrollbarstyle can define the style and position of the scroll bar for scrolling view, such as ListView, ScrollView, optional values are Insideoverlay, Insideinset, Outsideoverlay, Outsideinset four species.
Where inside and outside indicate whether in the padding area of the view, overlay and inset are overlaid on the view or behind the view, so four values are represented:
Insideoverlay: Default value, indicated within the padding area and overlaid on view
Insideinset: Represents within the padding area and is inserted behind the view
Outsideoverlay: Represents outside the padding area and is overlaid on the view
Outsideinset: Represents outside the padding area and is inserted behind View 4. Custom ScrollBar
android:scrollbars= "Vertical" android:fadescrollbars= "true" //true scrollbar do not scroll to hide Android: Scrollbarthumbvertical= "@drawable/scrollbar" //Custom ScrollBar
Android:scrollbartrackhorizontal= "@drawable/scrollbar_bg" //Custom scrollbar background android:scrollbarstyle= " Outsideinset " //scrollbar style
- Previous Android fragments detailed use
- Next Android Custom properties when the format option (<attr format= "reference" name= "background"/>)
Some properties of Android:scrollbar