In iOS, there is a very easy and powerful facility to animate the addition and removal of UITableView rows, here's a clip from a youtube video showing the default animation. Note how the surrounding rows collapse onto the deleted row. This animation helps users keep track of what changed in a list and where in the list they were looking at when the data changed.
Since I've been developing on Android I've found no equivalent facility to animate individual rows in a TableView. Calling notifyDataSetChanged() on my Adapter causes the ListView to immediately update its content with new information. I'd like to show a simple animation of a new row pushing in or sliding out when the data changes, but I can't find any documented way to do this. It looks like LayoutAnimationController might hold a key to getting this to work, but when I set a LayoutAnimationController on my ListView (similar to ApiDemo's LayoutAnimation2) and remove elements from my adapter after the list has displayed, the elements disappear immediately instead of getting animated out.
I've also tried things like the following to animate an individual item when it is removed:@Override
protected void onListItemClick(ListView l, View v, final int position, long id) {
Animation animation = new ScaleAnimation(1, 1, 1, 0);
animation.setDuration(100);
getListView().getChildAt(position).startAnimation(animation);
l.postDelayed(new Runnable() {
public void run() {
mStringList.remove(position);
mAdapter.notifyDataSetChanged();
}
}, 100);
}
However, the rows surrounding the animated row don't move position until they jump to their new positions whennotifyDataSetChanged() is called. It appears ListView doesn't update its layout once its elements have been placed.
While writing my own implementation/fork of ListView has crossed my mind, this seems like something that shouldn't be so difficult.
Tracking Valuable Threads from Worldwide Discussion Boards for Android Enthusiasts and Programmers
Popular Posts
-
Trying to found out how to enable "diagnostic" mode on an HTC Android device, specifically a T-Mobile G2 / HTC Desire Z. In my sea...
-
Does anyone know information about how to connect the Samsung Fascinate as Diag Mode driver? ie: this type of connection needed for QPST/QX...
-
Even a basic program that can encrypt and decrypt SD card, at least the external SD card would be acceptable. This way we can be assured tha...
-
On Android phones SMS messages registered to applications also get sent to the device's inbox. However to prevent clutter, it'd be n...
-
Joikuspot is a program for Symbian that bridges the WiFi and 3G connection so the phone acts as a hotspot for wireless connection. I figure ...
-
I decided to wipe all data by turning the phone off and then pressing the home key and the power key. From there it went to the recovery men...
-
I am brand new to cell phones so please excuse the very basic questions and problems I am having. I am trying to get QPST to work with my Sp...
-
Go to: 1. Settings 2. Applications 3. Manage Applications 4. Select Filter 5. Select All 6. Select "Maps" application. It w...
-
What is the best GPS application usable without an Internet connection? (Android) I don't use it by car, just for walking in cities. I...
-
I'm getting this error from time to time and don't know what causing this: When trying to run/debug an Android app on a real devic...