Make a scrollabe Gallery go to the top of image when Scrolled?
Hey, I have Pictures that are bigger than the screen in a gallery, so the gallery h开发者_运维技巧as scrollbars.. The problem is that if I go to the bottom of Picture1, and then scroll to go to Picture2, Picture2 stays viewed from the bottom... What I want is that when I go to Picture2, the gallery goes to the top of the Picture2...
Thanks.You can use this Listener to get a call back whenever a new item is selected in your gallery:
gal.setOnItemSelectedListener(new OnItemSelectedListener(){
@Override
public void onItemSelected(AdapterView<?> parent, View view,int position, long id) {
//Inside here you can call .scrollTo(0,0) on your ScrollView.
}
};
精彩评论