开发者

Image displayed at Gallery not to be centred

开发者 https://www.devze.com 2023-02-18 15:43 出处:网络
I am using Gallery class for displaying images. With the default implementation , the first image occupies the centre of the screen .

I am using Gallery class for displaying images. With the default implementation , the first image occupies the centre of the screen . If the first image(centre image) is scrolled towards the left of the screen , then the second image(next image) occupies the centre of the screen.

My requirement is that for the very first time , the first image should be displayed 20 dip from the left margin. I'll keep some spacing (60 dip) between the first & the second image.

I wanted to know , whether this is possible or not.

Kindly provide your inputs/sample code.开发者_运维技巧

Thanks in advance.

Warm Regards,

CB


If you don't want the Gallery to automatically move any Item to center after some user input, you should use an ScrollView, add your ImageViews there.

You can do that by placing your Gallery with 60dip padding or by overriding the Adapter from Gallery and return ImageViews with your own padding.

0

精彩评论

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