8
I wanted to understand what the ListViewAnimations
is (a component, a Framework?) and how it works.
8
I wanted to understand what the ListViewAnimations
is (a component, a Framework?) and how it works.
12
The ListViewAnimations
is a free code library for Android that allows you to add animations on items from ListView
easily, as can be seen in the example:
You can download and check usage tutorials, as well as more information at this link.
The library consists of separate modules:
lib-core
: the library core, also contains appearence animations (fade-in).lib-manipulation
: contains the manipulations of the ListView
, as the "Drag-to-Hide" (Swype-to-Dimiss) and the "Drag-and-Drop" (famous, Drag-and-Drop)lib-core-slh
: an extension of lib-core
to support the StickyListHeaders
. Example of the use of StickyListHeaders
Now you have three options:
Add the following to your build.gradle
:
repositories {
mavenCentral()
}
dependencies {
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar'
compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0@aar'
compile 'com.nhaarman.listviewanimations:lib-core-slh:3.1.0@aar'
}
Or you can download some files:
The . jar files should be added to your folder libs
or add them as jars external in the build path of your project.
Or you can also add the following to your pom.xml
:
<dependency>
<groupId>com.nhaarman.listviewanimations</groupId>
<artifactId>lib-core</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.nhaarman.listviewanimations</groupId>
<artifactId>lib-manipulation</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.nhaarman.listviewanimations</groupId>
<artifactId>lib-core-slh</artifactId>
<version>3.1.0</version>
</dependency>
Now that you’ve installed everything, let’s go to the animations in one ListView
.
1. Appearance animations (fade-in)
This animation serves as a fade-in (animation in the opacity of an object or media, increasing increasingly as a function of time).
MyAdapter myAdapter = new MyAdapter();
AlphaInAnimationAdapter animationAdapter = new AlphaInAnimationAdapter(myAdapter);
animationAdapter.setAbsListView(mListView);
mListView.setAdapter(animationAdapter);
You can create your own AnimationAdapter
, or use one of the default ones, which are:
AlphaAnimationAdapter
ScaleInAnimationAdapter
SwingBottomInAnimationAdapter
SwingLeftInAnimationAdapter
SwingRightInAnimationAdapter
In the example, the AlphaInAnimationAdapter
.
2. Dynamiclistview
The DynamicListView
is a class that features effects like Drag-and-Drop, Swype-to-Dismiss and animations to remove, move and insert items. It was made to match the above descriptions conveniently.
First include this in your XML layout:
<com.nhaarman.listviewanimations.itemmanipulation.DynamicListView
android:id="@+id/dynamiclistview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
3. Drag and Drop
To do it, call for enableDragAndDrop()
in his DynamicListView
and seven which items will be eligible to be picked up (drag), for this you can use the TouchViewDraggableManager
:
mDynamicListView.enableDragAndDrop();
mDynamicListView.setDraggableManager(new TouchViewDraggableManager());
You can also start the drag using startDraggin(int)
, for example in a OnItemLongClickListener
:
mDynamicListView.enableDragAndDrop();
mDynamicListView.setOnItemLongClickListener(
new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(final AdapterView<?> parent, final View view,
final int position, final long id) {
mDynamicListView.startDragging(position);
return true;
}
}
);
Note: this functionality is only possible on devices running ICS (API 14) or higher.
For other purposes, you can take a look on this page in English.
Withdrawn from here - in free translation
0
I found nothing on ListViewAnimation
in the official documentation, you are probably quoting the Listviewanimations, which is a lib that helps you in animations related to ListViews
and GridViews
. As for the use, has an application of example in the repository, the integration is reasonably well exemplified.
Browser other questions tagged android listview animation
You are not signed in. Login or sign up in order to post.
Thank you very much!
– paloma