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 increase images space and one more doubt bottom image reflection is hide how to get bottom reflection image.....
this is my xml source:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:pj="http://schemas.android.com/apk/res/com.carouseldemo.main"
xmlns:bm="com.carouseldemo.main"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:layout_weight="0.5"
android:padding="5dip"
android:gravity="top"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.carouseldemo.controls.Carousel
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/carousel"
pj:UseReflection="true"
pj:Items="@array/entries"
pj:SelectedItem="0"
android:animationDuration="200"
/>
</LinearLayout>
</LinearLayout>
pls see my screen shot:
It should be defined in Carousel.java file. Please check the following functions in
src/com/carouseldemo/controls/Carousel.java
getChildStaticTransformation
makeAndAddView
setUpChild
Calculate3DPosition
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.
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;
}