zoukankan      html  css  js  c++  java
  • android:scrollbar的一些属性

    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.   
    6.     <ScrollView  
    7.         android:id="@+id/view1"  
    8.         android:layout_width="100dip"  
    9.         android:layout_height="120dip"  
    10.         android:background="@android:color/white"  
    11.         android:padding="8dip"  
    12.         android:scrollbarStyle="insideOverlay" >  
    13.   
    14.         <TextView  
    15.             android:layout_width="fill_parent"  
    16.             android:layout_height="wrap_content"  
    17.             android:background="@android:color/darker_gray"  
    18.             android:text="scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text"  
    19.             android:textColor="#ffffff" />  
    20.     </ScrollView>  
    21.   
    22.     <ScrollView  
    23.         android:id="@+id/view2"  
    24.         android:layout_width="100dip"  
    25.         android:layout_height="120dip"  
    26.         android:background="@android:color/white"  
    27.         android:padding="8dip"  
    28.         android:scrollbarStyle="insideInset" >  
    29.   
    30.         <TextView  
    31.             android:layout_width="fill_parent"  
    32.             android:layout_height="wrap_content"  
    33.             android:background="@android:color/darker_gray"  
    34.             android:text="scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text"  
    35.             android:textColor="#ffffff" />  
    36.     </ScrollView>  
    37.   
    38.     <ScrollView  
    39.         android:id="@+id/view3"  
    40.         android:layout_width="100dip"  
    41.         android:layout_height="120dip"  
    42.         android:background="@android:color/white"  
    43.         android:padding="8dip"  
    44.         android:scrollbarStyle="outsideOverlay" >  
    45.   
    46.         <TextView  
    47.             android:layout_width="fill_parent"  
    48.             android:layout_height="wrap_content"  
    49.             android:background="@android:color/darker_gray"  
    50.             android:text="scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text"  
    51.             android:textColor="#ffffff" />  
    52.     </ScrollView>  
    53.   
    54.     <ScrollView  
    55.         android:id="@+id/view4"  
    56.         android:layout_width="100dip"  
    57.         android:layout_height="120dip"  
    58.         android:background="@android:color/white"  
    59.         android:padding="8dip"  
    60.         android:scrollbarStyle="outsideInset" >  
    61.   
    62.         <TextView  
    63.             android:layout_width="fill_parent"  
    64.             android:layout_height="wrap_content"  
    65.             android:background="@android:color/darker_gray"  
    66.             android:text="scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text"  
    67.             android:textColor="#ffffff" />  
    68.     </ScrollView>  
    69.   
    70. </LinearLayout>  

    2. 运行结果截图:insideInset、insideOverlay、outsideInset、outsideOverlay分别对应下图左边解释!


    3.android:scrollbarStyle可以定义滚动条的样式和位置,用于Listview、scrollview等滚动view,可选值有insideOverlay、insideInset、outsideOverlay、outsideInset四种。
    其中inside和outside分别表示是否在view的padding区域内,overlay和inset表示覆盖在view上或是插在view后面,所以四种值分别表示:
    insideOverlay:默认值,表示在padding区域内并且覆盖在view上
    insideInset:表示在padding区域内并且插入在view后面
    outsideOverlay:表示在padding区域外并且覆盖在view上
    outsideInset:表示在padding区域外并且插入在view后面
    4.自定义scrollbar
    android:scrollbars="vertical"
    	android:fadeScrollbars="true"                               //true scrollbar不滚动隐藏
    	android:scrollbarThumbVertical="@drawable/scrollbar"        //自定义scrollbar
            android:scrollbarTrackHorizontal="@drawable/scrollbar_bg"   //自定义scrollbar背景
    	android:scrollbarStyle="outsideInset"                                                             //scrollbar风格


     
  • 相关阅读:
    mysql中删除重复记录,并保留重复数据中的一条数据的SQL语句
    架构设计文档提纲简描
    各大互联网公司架构演进之路汇总
    大数据安全规范
    生活启示
    mysql数据库分库分表(Sharding)
    大数据风控指标----查准率与查全率
    YARN和MapReduce的内存设置参考
    不要在linux上启用net.ipv4.tcp_tw_recycle参数
    [Spark经验一]Spark RDD计算使用的函数里尽量不要使用全局变量
  • 原文地址:https://www.cnblogs.com/xgjblog/p/4173397.html
Copyright © 2011-2022 走看看