gpt4 book ai didi

java - 由 MaterialList 的 : java. lang.ClassNotFoundException 引起

转载 作者:太空宇宙 更新时间:2023-11-04 14:12:08 25 4
gpt4 key购买 nike

运行我的应用程序时,我收到Caused by: java.lang.ClassNotFoundException: Did not find class "com.dexafree.materiallistviewexample.view.MaterialListView"错误。我正在使用这个库https://github.com/dexafree/MaterialList 。这是我的代码。在 Github 上发布问题之前,我想确保自己没有做错什么。谢谢!

Fragment1.java:

public class  FragmentTab1 extends ListFragment {

private Context mContext;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

View view = inflater.inflate(R.layout.fragmenttab1, null);

mContext = getActivity();
MaterialListView mListView = (MaterialListView) view.findViewById(R.id.material_listview);

SimpleCard card = new SmallImageCard(mContext);
card.setDescription("Description");
card.setTitle("Title");
card.setDrawable(R.drawable.ic_launcher);

mListView.add(card);

return view;

}

FragmentTab1.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin">

<com.dexafree.materiallistviewexample.view.MaterialListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/material_listview"/>

</RelativeLayout>

构建.gradle:

    dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile ('com.github.dexafree:materiallist:2.0.1') {
exclude group: 'com.nhaarman.listviewanimations'
}
}

最佳答案

问题1

检查1MaterialListView`的路径。看来您使用了错误的路径。

问题2

将 ListView 的 id 更改为此

android:id="@android:id/list"

或扩展Fragment而不是ListFragment

关于java - 由 MaterialList 的 : java. lang.ClassNotFoundException 引起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28196818/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com