1

I've built my own listview with the specific design shown below. In order to get the rows to overlap as they do, I set the android:dividerHeight of the listview to -40dip.

Everything works great and just as expected with one little exception: whenever I scroll up (or down), the listview loads the new views too late since it somehow only starts loading the new view when the view which is currently at the bottom is fully visible on screen.

So now I have to either find a new way to implement the overlap effect or figure out a way to tell the listview to hold onto its views for just a little longer before it marks them as a scrapview (Edit: this behavior actually works fine, the views aren't being unloaded prematurely) or make the listview load the next view before the lowest (or topmost) one is fully on screen yet.

Any help would be really appreciated.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white" >

    <View
        android:layout_width="10dip"
        android:layout_height="match_parent"
        android:layout_centerHorizontal="true"
        android:background="@color/icygrey" />

    <ListView
        android:id="@+id/lvActivityTestListView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:dividerHeight="-40dip" >
    </ListView>

</RelativeLayout>

Here the 2nd last View is not fully on the screen yet view not yet loaded

Here it is -> so the next view suddenly appears view loaded (too late)

Simon Flückiger
  • 555
  • 1
  • 6
  • 11
  • That's because the box on the right side its still in view and hasn't gone passed the screen yet, and its the last item before next items load. even if you increased the load by 1 it will have a gap on the right side then. Can you load something like 50 items at a time instead so you don't get a gap on every page but on the 5thh or 6th page – Tasos Mar 26 '14 at 23:44
  • Thanks for helping me out here, Tasos. In the list you see above, I actually loaded 100 items and I took the screenshot when the list was somewhere in the middle. I'm not sure I'm really following with "a gap every page but 5 or 6", could you elaborate? – Simon Flückiger Mar 26 '14 at 23:51
  • as a test can you try and setting the width of the line in the middle ----- android:divider="@null" android:dividerHeight="0dp" – Tasos Mar 27 '14 at 00:01
  • As expected, setting the dividerHeight back to 0dp doesn't give me any problems. The more negative the dividerHeight, the more apparent the described behavior gets. – Simon Flückiger Mar 27 '14 at 00:13

0 Answers0