【发布时间】:2014-11-28 13:54:13
【问题描述】:
我尝试将appearance animation 添加到我的ListView。当我在互联网上搜索时,我终于找到了这个链接。 ListView appearance demo
这是我的MainActivity 和onCreateView
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_main);
ArrayList<String> strings = new ArrayList<String>();
strings.add("");
strings.add("");
strings.add("");
strings.add("");
strings.add("");
strings.add("");
MyListAdapter mAdapter = new MyListAdapter(this, strings);
SwingRightInAnimationAdapter swingRightInAnimationAdapter = new SwingRightInAnimationAdapter(mAdapter);
// Assign the ListView to the AnimationAdapter and vice versa
ListView myListView = (ListView) findViewById(R.id.myListView);
swingRightInAnimationAdapter.setAbsListView(myListView);
myListView.setAdapter(swingRightInAnimationAdapter);
}
但是当我启动这个简单的示例项目时,这个内容会出现错误:
致命异常:主要 java.lang.NoClassDefFoundError: com.nineoldandroids.animation.Animator[]
我下载了 jar 库并在 android studio 的 build.gradle 中使用它
repositories {
mavenCentral()}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/listviewanimations_lib-core_3.1.0.jar')}
如果可能,请帮助我 谢谢
【问题讨论】:
标签: android listview animation android-studio appearance