Hi,
I would like to use a ViewFlipper for each of my rows in a ListView.
The purpose is to animated the row when the row is selected. I have
managed to do this with but ...
When scrolling or moving quickly with the pad in the list, the rows
seems to blink... like if they were redrawed. This happens only if
startFlipping is called.
Thanks for helping me to understand what's behind startFlipping.

Here is some code :
getListView().setOnItemSelectedListener(new OnItemSelectedListener(){
            private ViewFlipper previous; // the last row where we
started an animation
            public void onItemSelected(AdapterView av, View v, int
position, long id){
                final ViewFlipper vs = (ViewFlipper)
(v.findViewById(R.id.text_switcher));
                if(!vs.isFlipping()){
                    // called twice so we avoid second call
                    vs.setInAnimation(inAnimation);
                    vs.setOutAnimation(outAnimation);
                    // stop animation on previous row
                    if(previous != null && previous.isFlipping()){
                        Log.v(TAG, "stop " +previous.toString());
                        previous.stopFlipping();
                        if(previous.getDisplayedChild() != 0 ){
                            previous.showNext();
                        }
                    }
                    previous = vs;
                    previous.startFlipping();
                }
            }
            public void onNothingSelected(AdapterView parent){}
        });

and a piece of xml :
<ViewFlipper android:id="@+id/text_switcher"
                          android:layout_width="fill_parent"
                  android:layout_height="wrap_content">

                             <TextView android:id="@+id/text1"
                                 android:textSize="18px"
                                 android:layout_width="fill_parent"
                                 android:layout_height="wrap_content"/>

                         <TextView android:id="@+id/text2"
                         android:textSize="18px"
                         android:layout_width="fill_parent"
                         android:layout_height="wrap_content"
                         android:textStyle="italic"/>

                         </ViewFlipper>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to