开发者

Make a scrollabe Gallery go to the top of image when Scrolled?

开发者 https://www.devze.com 2023-03-07 00:12 出处:网络
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 Pictur

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.
            }
};
0

精彩评论

暂无评论...
验证码 换一张
取 消