2016-04-18 140 views
0

我已阅读并尝试了有关从gridview中删除/隐藏滚动条的所有stackoverflow问题,但是,它不会消失!我正在测试运行棒棒糖的三星Galaxy S4。无法从gridview中删除滚动条

这里是我的XML:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/llChooserContainer" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:scrollbars="none" 
    android:layout_marginTop="?android:attr/actionBarSize" 
    android:orientation="vertical"> 

    <GridView 
     android:id="@+id/gvGallery" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     android:layout_margin="10dp" 
     android:columnWidth="@dimen/chooser_grid_col_width" 
     android:fadingEdgeLength="10dp" 
     android:fastScrollEnabled="true" 
     android:scrollbars="none" 
     android:gravity="center" 
     android:numColumns="auto_fit" 
     android:requiresFadingEdge="vertical" 
     android:scrollingCache="true" 
     android:stretchMode="columnWidth"/> 

</LinearLayout> 

这里是我的onCreate

llChooserContainer.setVerticalScrollBarEnabled(false); 
    llChooserContainer.setHorizontalScrollBarEnabled(false); 
    gvGallery.setOnItemClickListener(this); 
    gvGallery.setVerticalScrollBarEnabled(false); 
    gvGallery.setHorizontalScrollBarEnabled(false); 
    gvGallery.setAdapter(imagesAdapter); 

也试过像

gvGallery.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY); 

,并设置大小设置样式为null:

gvGallery.setScrollBarSize(0); 

和拇指空

android:scrollbarThumbHorizontal="@null" 
android:scrollbarThumbVertical="@null" 

没有什么在XML - > styles.xml我也试过清洁工程,无效缓存,每次卸载应用程序。

enter image description here

+0

的http://计算器。 COM /问题/ 4852867/HO w-to-disable-gridview-scroll-in-android –

+0

删除'fastScrollEnabled'终于解决了我的问题!谢谢!您可以添加,作为答案 –

+0

我在下面添加我的答案,请接受它。如果它适合你 –

回答

2

从GridView控件试试这个,删除以下属性:

android:fastScrollEnabled="true" 
0

你可以试试这个

android:fadeScrollbars="false" 

android:scrollbarThumbVertical="@android:color/transparent"