Scrollbar not working

by New Developer » Sun, 27 Mar 2011 20:11:22 GMT


Sponsored Links
 I have the following in the XML
<TableLayout android:id="@+id/TableLayout01" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:scrollbars="vertical"
    android:scrollbarSize="20dp"
    android:scrollbarAlwaysDrawVerticalTrack="true"
    android:stretchColumns="*">
    <TableRow>
      <ListView
        android:id="@+id/main_list" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:smoothScrollbar="true"
        android:fastScrollEnabled="true"
        android:scrollbars="vertical"
        android:scrollbarStyle="insideInset"
        android:scrollbarSize="20dip"
        android:textColor="#00ee00"></ListView>
    </TableRow>
  </TableLayout>

I add the items dynamically from a database using

private ListView  listView = null;
listView = (ListView) findViewById(R.id.main_list);
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);

It shows a very narrow scrollbar.
But the list does not scroll and the scroll bar has no effect, which I click 
the scrollbar to move it
the scrollbar fades away.  any Ideas ?


Thanks in advance

-- 



Re: Scrollbar not working

by Mark Murphy » Sun, 27 Mar 2011 20:28:34 GMT


 Android does not use scrollbars for more than a momentary display of
position. This is by design. The concept of a scrollbar as being the
mechanism for scrolling is for mouse-based UIs. Touchscreens scroll
via gestures sliding the whole thing up and down.

I strongly encourage you to use some touchscreen hardware -- whether
or not it is an Android phone -- before you start attempting to write
Android applications.






-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

Android Training in Oslo:  http://bit.ly/fjBo24 

-- 


Sponsored Links


Re: Scrollbar not working

by New Developer » Sun, 27 Mar 2011 23:43:38 GMT


 Thanks

I have tried an android phone
Okay let me ask this  how then to you correctly test a ListView  with a scroll  
on the emulator ??
What is the correct method ?

Thanks again






-- 



Re: Scrollbar not working

by Mark Murphy » Sun, 27 Mar 2011 23:45:52 GMT


 Use your mouse to simulate a finger.








-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

Android Training in Oslo:  http://bit.ly/fjBo24 

-- 



Other Threads

1. Tracking activity launch

Hi,

I'm trying to write a service that can tracks activity. It just need
to get information when any activity is opened or closed on the
device.
I didn't find the solution with BroadcastReceiver, Intent or
LauncherActivity
So i've looked for AccessibilityManager/AccessibilityEvent,
ActivityManager, PackageManager

But didn't find yet; i'm sure there is a simple way to do this

Anyone knows ?

Thanks for your help !

-- 

2. How to add labels above this table layout

I have following tablelayout in my xml file.

<?xml version="1.0" encoding="utf-8"?>

<TableLayout xmlns:android="http://schemas.android.com/apk/res/
android"

    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <TableRow>
                        android:textColor="#00FF00">
                <TextView android:id="@+id/roomName"
                android:layout_width="85px"
                android:textSize="15sp"
                android:textColor="#00FF00"
                        android:typeface="monospace"
                android:gravity="center" />


                <TextView android:id="@+id/switchName"
                android:layout_width="85px"
                android:textSize="15sp"
                android:textColor="#00FF00"
                        android:typeface="monospace"
                android:gravity="center" />


                <TextView android:id="@+id/startDate"
                android:layout_width="95px"
                android:textSize="15sp"
                android:textColor="#00FF00"
                        android:typeface="monospace"
                android:gravity="center" />


                <TextView android:id="@+id/totalTime"
                android:layout_width="50px"
                android:textSize="15sp"
                android:textColor="#00FF00"
                        android:typeface="monospace"
                android:gravity="center"  />

                <TextView android:id="@+id/stopDate"
                android:layout_width="95px"
                android:textSize="15sp"
                android:textColor="#00FF00"
                        android:typeface="monospace"
                android:gravity="center" />

                <TextView android:id="@+id/totalStopTime"
                android:layout_width="50px"
                android:textSize="15sp"
                android:textColor="#00FF00"
                        android:typeface="monospace"
                android:gravity="center"  />

           </TableRow>
 </TableLayout>

Here I have 6 columns in each row. Now I want to add label to each
column which must be visible after scrolling this list.

Thanks

-- 

3. How to imitate multi-touch by emulator

4. Audio output is mono in my application

5. RT2070 Android2.1 Issue

6. Adding application to the source code

7. Sensitivity of SCROLL_STATE_FLING event