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.
Related
Please help me in implementing the gallery like as in image attached. I wish the images to be clickable and while left-right swipe, the new images in the left and right make similar configuration. On right swipe Full image goes and settles to the place of half right image, left half image settles to the full middle image and a new image from the left comes and settles at the left half image. Similar configuration is required on left swipe.
Thanks and Regards
To achieve this it you need to follow below steps
1. Create gallery
2. Create image adapter
3. Set width of gallery and view of adapter (image view) according to your need.
if you want some simple view then please follow below link:
https://github.com/davidschreiber/FancyCoverFlow
https://github.com/JakeWharton/salvage
https://github.com/Trinea/android-auto-scroll-view-pager
I hope, it will help for you.
I would like to create an image picker as shown in the picture below. What is the best way to go about it?
The screen should show the current image on the center and the next and previous on its side which is a smaller image size. On swipe, the images should change. It will be helpful if someone can point to an existing code similar to this.
Thanks
I have working sample of image gallery.
Now if I have 10 images in gallery, few of them gets displayed initially, lets say 3 (based on image thumbnail dimensions), and rest of the images can be viewed by scrolling the gallery.
I want to change this a bit.
Based on image thumbnail dimensions, few images should be displayed initially and instead of scrolling, there should be previous and next buttons, on click of which images will shift left or right.
Any help appreciated.
You can use gallery and onButtonPress call onFling (for smooth scrolling, or simple select next image) event to change selected item.
Or you can use LinearLayout, calculate image dimensions runtime, create child imageViews for parent linearLayout and onclick fill this views with your images
At last i finished my work and now i need to hand it to designer. App has some buttons and checkboxes.
So the question how big button and checkbox should she draw for each screen size(ldpi,mdpi,hdpi,xhdpi) or she could draw just one image for button and anotherone for checbox and it could be scaled?
Thank you already.
It really depends on how big your buttons are. U can check the following link for sizes:
http://developer.android.com/images/screens_support/screens-densities.png
But I agree with Mikelsreal (create a 9 patch image).
Create the button image in whatever size u like.
Add black pixels above the image to set where the image should be stretch horizontal.
Add black pixels on the left side of the image to set where the image should be stretch vertical.
Add black pixels on the right side where the content can be placed vertical
Add black pixels below the image to set where the content can be placen horizontal
rename the image like : yourImageName.9.png
and it should work.
for more info check (developer.android.com/tools/help/draw9patch.html)
I have a image with the size of 1299 * 625. I want to show the image in Gallery view like first half is one page and second of is another page. Sorry for my Bad English..
Use the ViewPager and add two ImageViews to it. Split you image in half and assign each half to one ImageView.