Some properties of Android:scrollbar

Source: Internet
Author: User

1. Activity_maim.xml[HTML]View Plaincopy
  1. <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
  2. android:layout_width="fill_parent"
  3. android:layout_height="fill_parent"
  4. android:orientation="vertical" >
  5. <ScrollView
  6. android:id="@+id/view1"
  7. android:layout_width="100dip"
  8. android:layout_height="120dip"
  9. android:background="@android: Color/white"
  10. android:padding="8dip"
  11. android:scrollbarstyle="Insideoverlay" >
  12. <TextView
  13. android:layout_width="fill_parent"
  14. android:layout_height="wrap_content"
  15. android:background="@android: Color/darker_gray"
  16. android:text="scroll_text scroll_text scroll_text scroll _text Scroll_text scroll_text scroll_text "
  17. android:textcolor="#ffffff" />
  18. </ScrollView>
  19. <ScrollView
  20. android:id="@+id/view2"
  21. android:layout_width="100dip"
  22. android:layout_height="120dip"
  23. android:background="@android: Color/white"
  24. android:padding="8dip"
  25. android:scrollbarstyle="Insideinset" >
  26. <TextView
  27. android:layout_width="fill_parent"
  28. android:layout_height="wrap_content"
  29. android:background="@android: Color/darker_gray"
  30. android:text="scroll_text scroll_text scroll_text scroll _text Scroll_text scroll_text scroll_text "
  31. android:textcolor="#ffffff" />
  32. </ScrollView>
  33. <ScrollView
  34. android:id="@+id/view3"
  35. android:layout_width="100dip"
  36. android:layout_height="120dip"
  37. android:background="@android: Color/white"
  38. android:padding="8dip"
  39. android:scrollbarstyle="Outsideoverlay" >
  40. <TextView
  41. android:layout_width="fill_parent"
  42. android:layout_height="wrap_content"
  43. android:background="@android: Color/darker_gray"
  44. android:text="scroll_text scroll_text scroll_text scroll _text Scroll_text scroll_text scroll_text "
  45. android:textcolor="#ffffff" />
  46. </ScrollView>
  47. <ScrollView
  48. android:id="@+id/view4"
  49. android:layout_width="100dip"
  50. android:layout_height="120dip"
  51. android:background="@android: Color/white"
  52. android:padding="8dip"
  53. android:scrollbarstyle="Outsideinset" >
  54. <TextView
  55. android:layout_width="fill_parent"
  56. android:layout_height="wrap_content"
  57. android:background="@android: Color/darker_gray"
  58. android:text="scroll_text scroll_text scroll_text scroll _text Scroll_text scroll_text scroll_text "
  59. android:textcolor="#ffffff" />
  60. </ScrollView>
  61. </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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.