views:

26

answers:

1

Hi,

I have a menu that is made up of a HorizontalScrollView that has a LinearLayout with TextViews. When a user swipes/scrolls I want to be able to show and not show a leading and trailing image that represents that there are more options. So, when the application starts, the far left image is not shown but the far right image is. Once the user swipes to go right, the far left image is shown. When you get to the very last option to the right, the right image is gone.

I have tried to use the SimpleOnGestureListener but it seems that the position reported is where the user is instead of the position of the list. I was thinking I could just do something like:

if(scrollX < 200.0) { tempL.setVisibility(View.INVISIBLE); } else tempL.setVisibility(View.VISIBLE);

I even implemented both onFling and onScroll methods to try but did not get the expected results. Also, the position is only reported when the user scrolls again. So, a fling position may be 1278 and go all the way to 0 but 0 is not reported until the user tries to fling again.

Thanks.

A: 

You can use gallery for this. It has some limitations though, but I guess it would suit your requirement better than a horizontal Scroll View.

Kumar Bibek