I downloaded sample android carousel demo source code in below link carousel demo source code link
my doubt is if I add more images, images gap is very low so how to
I modified the code in Calculate3DPosition
to include the usage of a NEW verticalStretchFactor
in the calculation of the y
:
Calculate3DPosition
float y = -getHeight()/2f + (float) (diameter/mVerticalStretchFactor * z * android.util.FloatMath.sin(mTheta));
I added this new attribute parameter to the attrs of the control. I found a factor on the order of 140f worked well on a standard Droid Phone display to provide more vertical spacing between the items in the list. I was using the control as a Home Menu control and only had 5 to 6 items in the list.
It should be defined in Carousel.java file. Please check the following functions in
src/com/carouseldemo/controls/Carousel.java
getChildStaticTransformation
makeAndAddView
setUpChild
Calculate3DPosition
Thank you all for your answers, especially Sen ,lepert.. I fix the issue of false selection of click with large images .Your solution is very much useful if the user needs to get the images untouched only but the issue still remains .
If any one need to make the spinner images untouched as given like the sample image given above by Balaji ,Use Sen's and lepert solution.
And if you want to make the images beneth the main one and get clicks /selections correctly change the code as given below ..This works for me ..
Change in
pointToPosition(int x, int y) in CorousalSpinner.java no need to change the code given by the above solutions
replace
Collections.sort(fitting);
if(fitting.size() != 0)
return fitting.get(0).getIndex();
else
return mSelectedPosition;
with
Collections.sort(fitting);
if(fitting.size() != 0){
if(fitting.size()>1){
return fitting.get((fitting.size()-1)).getIndex();
}else{
return fitting.get(0).getIndex();
}
}
else{
return mSelectedPosition;
}