2012-09-19 29 views
2

我已经看到了很多Android应用程序那些有ListView,我的ListViews有一些不同。在见过这样theire ListView的滚动条:使ListView滚动条的区别和更有用

enter image description here

在画面

当您滚动您的列表滚动条会显示和u可以触摸它,更容易滚动以上。

,但在我的应用程序见过这样的:

enter image description here

这是我的布局XML代码:

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center" 
     android:paddingBottom="4dp" 
     android:text="@string/do" 
     android:textSize="16dp" /> 

    <ListView 
     android:id="@+id/lv" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@drawable/main_background" 

     > 
    </ListView> 
</LinearLayout> 

我用Google搜索了很多次,但我没有发现任何伎俩。任何人都可以帮助我如何让我的卷轴像图片一样吗?

回答

5

您可以添加这些在你的列表视图中的行。它为我工作。

android:fastScrollEnabled="true" 
    android:scrollbars="none 
+0

这工作正常。谢谢你 – aTa

3

在列表视图的属性中设置了android:fastScrollEnabled="true"。 此外,如果你想快速滚动拇指可见一如既往地设定android:fastScrollAlwaysVisible="true"

然后在列表视图中的XML定义,你有这样的事情:

<ListView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:fastScrollAlwaysVisible="true" 
    android:fastScrollEnabled="true" > 
</ListView> 
+0

感谢üyrajabi,但它不工作:( – aTa

+0

@aTa还添加机器人:滚动条=“无”(如下建议),看看它是否工作,而且最好在这里发表您的布局xml文件。 ,所以我们可以检查它来检测有问题的性质。 – yrajabi

+0

更新我的职位和编写XML代码,如u想 – aTa

-1
Hi Use This attribute in your ListView which you declare in you layout file. 

android:scrollbars="none" 
+0

感谢üRishabh.CreatioSoft但不工作 – aTa

+0

你能再次解释你想要什么吗? – yokees