2

i have seen a lot of android apps those have a ListView that some differences with my ListViews. in theire ListView Scroll bar seen like this:

enter image description here

in picture above when you scroll your list that scroll bar will be shown and u can touch on it and scroll easier.

but in my app seen like this:

enter image description here

this is my layout xml code:

<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>

i had googled many times but i didnt find any trick. can anybody help me how i can make my scroll like picture one?

aTa
  • 641
  • 2
  • 8
  • 20

3 Answers3

5

You can add these lines in your listview. It worked for me.

    android:fastScrollEnabled="true"
    android:scrollbars="none
Agnihotri.
  • 426
  • 3
  • 12
3

set android:fastScrollEnabled="true" in properties of the listview. Also if you want fast scroll thumb to be visible always, set android:fastScrollAlwaysVisible="true"

then, in your xml definition of the listview, you would have something like this:

<ListView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:fastScrollAlwaysVisible="true"
    android:fastScrollEnabled="true" >
</ListView>
yrajabi
  • 637
  • 1
  • 9
  • 28
  • @aTa also add android:scrollbars="none" (as suggested below) and see if it works. And it is better to post your layout xml file here, so we can check it to detect the problematic properties. – yrajabi Sep 19 '12 at 13:23
  • thank uuuuuu yrajabi. your code works ok. the promblem was in my theme :) – aTa Sep 19 '12 at 14:19
-1
Hi Use This attribute in your ListView which you declare in you layout file.

android:scrollbars="none"
Rishabh Agrawal
  • 861
  • 2
  • 15
  • 25