zoukankan      html  css  js  c++  java
  • Android-关于android:scrollbarStyle属性

    1. activity_maim.xml

    <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. 运行结果截图:

    3. 相关说明:

    android:scrollbarStyle可以定义滚动条的样式和位置,可选值有insideOverlay、insideInset、outsideOverlay、outsideInset四种。
    其中inside和outside分别表示是否在view的padding区域内,overlay和inset表示覆盖在view上或是插在view后面,所以四种值分别表示:
    insideOverlay:默认值,表示在padding区域内并且覆盖在view上
    insideInset表示在padding区域内并且插入在view后面
    outsideOverlay:表示在padding区域外并且覆盖在view上,推荐这个
    outsideInset:表示在padding区域外并且插入在view后面

    本文转自:http://blog.csdn.net/duanyipeng/article/details/8591575

  • 相关阅读:
    Gym
    Gym
    Gym
    Gym
    Gym
    bzoj 2734: [HNOI2012]集合选数
    bzoj 1068: [SCOI2007]压缩
    HDU 2899 Strange fuction
    hihocoder #1142 : 三分·三分求极值
    HDU 2824 The Euler function
  • 原文地址:https://www.cnblogs.com/sishuiliuyun/p/4275073.html
Copyright © 2011-2022 走看看