I have a list view inside which a linear layout with lots of items. Now i want to have a imageview at the button stating scrolldown till the end of the scrollview is reached and once the end is reached to hide it self. Again once the user scrolls up, the imageview should re appear. Can anyone please tell how to detect the end of scrollview?? Searched several forums but they have given for listview, but i badly need for scroll view only. Please help!
Asked
Active
Viewed 1,877 times
2 Answers
1
You can detect the end of scrolling by the following code
if (yourListView.getLastVisiblePosition() == yourListView.getAdapter().getCount() -1 &&
yourListView.getChildAt(yourListView.getChildCount() - 1).getBottom() <= yourListView.getHeight())
{
//It is scrolled all the way down here
}
Hope it helps.

ayon
- 2,180
- 2
- 17
- 32
0
You have to check the array list count on getView(int position, View convertView, ViewGroup parent)
method in BaseAdapter class
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.rowlayout, parent, false);
ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
// Change the visibility here
if(list.size >= position)
imageView.setVisibility(View.Gone);
else
imageView.setVisibility(View.Visible);
return rowView;
}

Imran Ali
- 539
- 4
- 17
-
Hi thanks for the reply, but i could'n get u fully, what do position converView and parent represent here?? can you please elaborate on the same! – bharath Apr 19 '13 at 06:28