I try to know when the user is scrolling over the end of the screen.
My layout is ScrollView.
I create new costume ScrollView object to override onScrollChanged using to code here:
My code for knowing when the user scrolls to the end of the screen is:
I create view in my layout below my scrollview called checkEndOfList
.
In my code i try to check the end of the list if is shown.
My XML:
<com.example.workoutlog.WallScrollView
android:id="@+id/wallList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stackFromBottom="true"
android:transcriptMode="alwaysScroll" >
<LinearLayout
android:id="@+id/workoutsWall"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</com.example.workoutlog.WallScrollView>
<LinearLayout
android:id="@+id/checkEndOfList"
android:layout_width="fill_parent"
android:layout_height="0.1sp"
android:layout_below="@+id/wallList"
android:orientation="horizontal"
android:background="@color/transparent" >
</LinearLayout>
This is my java code for checking is the user scrolls over the end of the page:
@Override
public void onScrollChanged(WallScrollView scrollView, int x,
int y, int oldx, int oldy) {
// TODO Auto-generated method stub
if(y - oldy == 0 && checkEndOfList.isShown() && y != 0 && oldy != 0)
{
//MY CODE
}
The code i tried doest work for me. I get call for end of screen even when i didnt scrolled over the screen.
Thank for helping.