making the edge of the scrollview fade when scrolling in android

前端 未结 3 1833
忘掉有多难
忘掉有多难 2020-12-08 06:30

I have a ScrollView with an image in it.

I want the edges of the ScrollView to make a fade effect when I scroll the image. I\'m not talking

相关标签:
3条回答
  • 2020-12-08 07:00

    this is for horizontal:

    <HorizontalScrollView
        android:id="@+id/scroll"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:requiresFadingEdge="horizontal"
        android:fadingEdgeLength="80dp">
    
    0 讨论(0)
  • 2020-12-08 07:06

    I am not sure if you this working, but here is what worked for me:

    <ScrollView android:requiresFadingEdge="vertical">
    

    and in your code, you can do the following

    ScrollView scroll = findById(); scroll.setFadingEdgeLength(150);
    
    0 讨论(0)
  • 2020-12-08 07:15

    Add these lines in your ScrollView xml code.

    <ScrollView
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fadeScrollbars="true"
        android:requiresFadingEdge="vertical"
        android:fadingEdgeLength="50dp">
    
    0 讨论(0)
提交回复
热议问题