Android : How to add animation to spinner?

on Friday, October 10, 2014


I have a programm haveing three radho buttons and three spinners


When I click 1st radio button - all spinners visible When I click 2nd radioo button - third spinner becomes invisible ( leaving out onl spinner 1 and spinner 2 on UI )


When i click 3rd radio button - Even spinner 2 becomes invisible ( thus leaving out only spinner 1 on UI )


I want animation to occur so that when only two spinners are visible, they slide down and fix themselves to center of screen


when only one spinner is in UI, it slides and arranges itself at center of screen, and one 1st radio button is clicked, all three spinners are visible and they animate and slide themselves to occupy center of screen.


DOUBT 1 I did try...setting animation - when i applied animation to only individual spinner - they used to hide under unseen invisible spinner


DOUBT 2 when i applieed animation to container i.e. spins layout


Animation is okay - but array adapter is stuck to its intitial position - that means on clicking on new position of spinner, norhing works, I have to click on its original position to get a drop down


xml file containg three spinners



<LinearLayout
android:id="@+id/spins"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/RD"
android:layout_centerHorizontal="true"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:animateLayoutChanges="true"
android:gravity="center_horizontal"
android:orientation="vertical" >

<Spinner
android:id="@+id/bl"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:prompt="@string/bra" />

<Spinner
android:id="@+id/sm"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:prompt="@string/sem" />

<Spinner
android:id="@+id/sb"
android:layout_width="250dp"
android:layout_height="wrap_content" />
</LinearLayout>

0 comments:

Post a Comment