Autohide scrollbars when not scrolling in a ListView

前端 未结 4 448
广开言路
广开言路 2021-01-12 09:01

In the new official Twitter app, the scrollbars in all the ListViews the app uses are hidden unless the user is scrolling through the list.

When you start scrollin

4条回答
  •  没有蜡笔的小新
    2021-01-12 09:16

    I followed Alex's answer and it worked using both the theme settings and through code.

    GridView gridview = (GridView) findViewById(R.id.mygridView);
    gridview.setScrollbarFadingEnabled(false);
    

    I did encounter a problem however with the Gallery Component. Whilst the following will compile fine, it will throw a NullPointerException. I assume this is to do with a Gallery not having scrollbars to show/hide.

    Gallery gallery = (Gallery) findViewById(R.id.myGallery);
    gallery.setScrollbarFadingEnabled(false); // <-- this will throw an exception
    

    Android 2.2

提交回复
热议问题