Search code examples
androidhorizontalscrollview

How to set scrollview scrollbar edges invisible while scrolling programmatically


I know how to achieve scrollbar fading by declaring in our xml layout file when i have set this attribute over scrollview generated at runtime i didnt have any idea how to achieve.

 <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_x="0dp"
        android:layout_y="0dp"
        android:scrollbarFadeDuration="5" >



HorizontalScrollView sv=new HorizontalScrollView(this);
          sv.addView(n);
          sv.pageScroll(0);
          sv.setBackgroundColor(0);

          sv.setScrollbarFadingEnabled(true);
          sv.setHorizontalFadingEdgeEnabled(true);

I wanted to set invisible scrollbar in above horizontal scroll view created at runtime. Please guide me .Thanks in Advance.


Solution

  • Try adding

    sv.setHorizontalScrollBarEnabled(false);
    sv.setVerticalScrollBarEnabled(false);