我正在尝试在我的代码中集成“com.fortysevendeg.swipelistview.SwipeListView”。
我从here.
获取代码实际上我遵循了指南,但是我从“完整项目”中获取了代码,因此我知道项目和库工作正常。
首先,我尝试在我的xml文件中集成“SwipeListView”。(我添加了所有设置文件后,如样式,图像等。)
我的应用在活动加载前崩溃。
这是我的Activity.XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/firstbackgroundclean"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- ++++++++++++++++++ Row-1 ++++++++++++++++++ -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp">
<Button
android:id="@+id/BtnBack"
android:layout_width="38dp"
style="@style/buttonnavigate"
android:background="@drawable/backbutton"
android:layout_marginTop="15dp"
android:layout_marginLeft="15dp"
android:layout_height="38dp" />
</LinearLayout>
<!-- ++++++++++++++++++++++++++++++++++++++++++ -->
<!-- ++++++++++++++++++ Row2 ++++++++++++++++++ -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:gravity="center"
android:id="@+id/textView0"
android:layout_width="match_parent"
android:textColor="@android:color/black"
android:textStyle="bold"
android:layout_height="wrap_content"
android:text="TEST RESULTS"
android:textSize="25sp" />
</LinearLayout>
<!-- ++++++++++++++++++++++++++++++++++++++++++ -->
<!-- ++++++++++++++++++ Row1 ++++++++++++++++++ -->
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.fortysevendeg.swipelistview.SwipeListView
xmlns:swipe="http://schemas.android.com/apk/res-auto"
android:id="@+id/example_swipe_lv_list"
android:listSelector="#00000000"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
swipe:swipeFrontView="@+id/front"
swipe:swipeBackView="@+id/back"
swipe:swipeDrawableChecked="@drawable/choice_selected"
swipe:swipeDrawableUnchecked="@drawable/choice_unselected"
swipe:swipeCloseAllItemsWhenMoveList="true"
swipe:swipeMode="both"
/>
</LinearLayout>
<!-- ++++++++++++++++++++++++++++++++++++++++++ -->
<!-- ++++++++++++++++++ Row2 ++++++++++++++++++ -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:gravity="left"
android:id="@+id/textView4"
android:layout_width="0sp"
android:layout_weight="1.0"
android:textColor="@android:color/black"
android:layout_height="wrap_content"
android:text="Sperm need to move to reach and egg. This movement is called: Motility or Motile Sperm."
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5sp"
android:textSize="15sp" />
</LinearLayout>
<!-- ++++++++++++++++++++++++++++++++++++++++++ -->
<!-- ++++++++++++++++++ Row3 ++++++++++++++++++ -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:gravity="left"
android:id="@+id/textView3"
android:layout_width="0sp"
android:layout_weight="1.0"
android:textColor="@android:color/black"
android:layout_height="wrap_content"
android:text="According the World Health Organization, test results do not show if a man’s sperm is normal or abnormal with 100% accuracy. However, it is generally accepted that the normal # of moving sperm is > 12 Million in each milliliter of semen."
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5sp"
android:textSize="15sp" />
</LinearLayout>
<!-- ++++++++++++++++++++++++++++++++++++++++++ -->
<!-- ++++++++++++++++++ Row4 ++++++++++++++++++ -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:gravity="left"
android:id="@+id/textView1"
android:layout_width="0sp"
android:layout_weight="1.0"
android:textColor="@android:color/black"
android:layout_height="wrap_content"
android:text="If your tests results are ABNORMAL or BORDERLINE re-run the test a second or third time with a week or between tests. Your results can change over time. Seek medical advice if all of your results are ABNORMAL or BORDERLINE."
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5sp"
android:textSize="15sp" />
</LinearLayout>
<!-- ++++++++++++++++++++++++++++++++++++++++++ -->
<!-- ++++++++++++++++++ Row4 ++++++++++++++++++ -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/BtnDelete"
style="@style/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="DELETE ARCHIVE"
android:textSize="18dip" />
</LinearLayout>
<!-- ++++++++++++++++++++++++++++++++++++++++++ -->
</LinearLayout>
</LinearLayout>
这是我的日志:
09-07 16:45:13.041: I/jdwp(13517): Ignoring second debugger -- accepting and dropping
09-07 16:45:20.996: W/ApplicationPackageManager(14043): getCSCPackageItemText()
09-07 16:45:21.076: D/dalvikvm(14043): GC_FOR_ALLOC freed 82K, 11% free 16837K/18892K, paused 24ms, total 25ms
09-07 16:45:21.091: I/dalvikvm-heap(14043): Grow heap (frag case) to 21.828MB for 3630224-byte allocation
09-07 16:45:21.106: D/dalvikvm(14043): GC_FOR_ALLOC freed <1K, 10% free 20382K/22440K, paused 12ms, total 12ms
09-07 16:45:21.446: D/OpenGLRenderer(14043): Enabling debug mode 0
09-07 16:45:22.616: I/dalvikvm(14043): Could not find method android.support.v4.app.NavUtils.navigateUpFromSameTask, referenced from method com.example.homedevice.VideoResultsScreenAct.onOptionsItemSelected
09-07 16:45:22.616: W/dalvikvm(14043): VFY: unable to resolve static method 256: Landroid/support/v4/app/NavUtils;.navigateUpFromSameTask (Landroid/app/Activity;)V
09-07 16:45:22.616: D/dalvikvm(14043): VFY: replacing opcode 0x71 at 0x000c
09-07 16:45:22.621: W/ApplicationPackageManager(14043): getCSCPackageItemText()
09-07 16:45:22.651: D/dalvikvm(14043): GC_FOR_ALLOC freed 67K, 9% free 21198K/23240K, paused 11ms, total 11ms
09-07 16:45:22.666: I/dalvikvm-heap(14043): Grow heap (frag case) to 26.086MB for 3630224-byte allocation
09-07 16:45:22.676: D/dalvikvm(14043): GC_FOR_ALLOC freed 1K, 8% free 24742K/26788K, paused 12ms, total 12ms
09-07 16:45:22.686: D/skia(14043): ---- fAsset->read(2729) returned 0
09-07 16:45:22.696: I/dalvikvm(14043): Could not find method android.support.v4.view.ViewConfigurationCompat.getScaledPagingTouchSlop, referenced from method com.fortysevendeg.swipelistview.SwipeListView.init
09-07 16:45:22.696: W/dalvikvm(14043): VFY: unable to resolve static method 259: Landroid/support/v4/view/ViewConfigurationCompat;.getScaledPagingTouchSlop (Landroid/view/ViewConfiguration;)I
09-07 16:45:22.696: D/dalvikvm(14043): VFY: replacing opcode 0x71 at 0x0141
09-07 16:45:22.696: I/dalvikvm(14043): Could not find method android.support.v4.view.MotionEventCompat.getActionMasked, referenced from method com.fortysevendeg.swipelistview.SwipeListView.onInterceptTouchEvent
09-07 16:45:22.696: W/dalvikvm(14043): VFY: unable to resolve static method 258: Landroid/support/v4/view/MotionEventCompat;.getActionMasked (Landroid/view/MotionEvent;)I
09-07 16:45:22.696: D/dalvikvm(14043): VFY: replacing opcode 0x71 at 0x0003
09-07 16:45:22.706: D/AbsListView(14043): Get MotionRecognitionManager
09-07 16:45:22.721: D/AndroidRuntime(14043): Shutting down VM
09-07 16:45:22.721: W/dalvikvm(14043): threadid=1: thread exiting with uncaught exception (group=0x418b0c08)
09-07 16:45:22.726: E/AndroidRuntime(14043): FATAL EXCEPTION: main
09-07 16:45:22.726: E/AndroidRuntime(14043): Process: com.example.homedevice, PID: 14043
09-07 16:45:22.726: E/AndroidRuntime(14043): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.homedevice/com.example.homedevice.VideoResultsScreenAct}: android.view.InflateException: Binary XML file line #52: Error inflating class com.fortysevendeg.swipelistview.SwipeListView
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.app.ActivityThread.access$900(ActivityThread.java:161)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.os.Handler.dispatchMessage(Handler.java:102)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.os.Looper.loop(Looper.java:157)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.app.ActivityThread.main(ActivityThread.java:5356)
09-07 16:45:22.726: E/AndroidRuntime(14043): at java.lang.reflect.Method.invokeNative(Native Method)
09-07 16:45:22.726: E/AndroidRuntime(14043): at java.lang.reflect.Method.invoke(Method.java:515)
09-07 16:45:22.726: E/AndroidRuntime(14043): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
09-07 16:45:22.726: E/AndroidRuntime(14043): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
09-07 16:45:22.726: E/AndroidRuntime(14043): at dalvik.system.NativeStart.main(Native Method)
09-07 16:45:22.726: E/AndroidRuntime(14043): Caused by: android.view.InflateException: Binary XML file line #52: Error inflating class com.fortysevendeg.swipelistview.SwipeListView
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.view.LayoutInflater.createView(LayoutInflater.java:626)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
09-07 16:45:22.726: E/AndroidRuntime(14043): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:359)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.app.Activity.setContentView(Activity.java:2010)
09-07 16:45:22.726: E/AndroidRuntime(14043): at com.example.homedevice.VideoResultsScreenAct.onCreate(VideoResultsScreenAct.java:93)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.app.Activity.performCreate(Activity.java:5426)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
09-07 16:45:22.726: E/AndroidRuntime(14043): ... 11 more
09-07 16:45:22.726: E/AndroidRuntime(14043): Caused by: java.lang.reflect.InvocationTargetException
09-07 16:45:22.726: E/AndroidRuntime(14043): at java.lang.reflect.Constructor.constructNative(Native Method)
09-07 16:45:22.726: E/AndroidRuntime(14043): at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
09-07 16:45:22.726: E/AndroidRuntime(14043): at android.view.LayoutInflater.createView(LayoutInflater.java:600)
09-07 16:45:22.726: E/AndroidRuntime(14043): ... 24 more
09-07 16:45:22.726: E/AndroidRuntime(14043): Caused by: java.lang.NoClassDefFoundError: android.support.v4.view.ViewConfigurationCompat
09-07 16:45:22.726: E/AndroidRuntime(14043): at com.fortysevendeg.swipelistview.SwipeListView.init(SwipeListView.java:205)
09-07 16:45:22.726: E/AndroidRuntime(14043): at com.fortysevendeg.swipelistview.SwipeListView.<init>(SwipeListView.java:149)
09-07 16:45:22.726: E/AndroidRuntime(14043): ... 27 more
09-07 16:47:52.821: I/Process(14043): Sending signal. PID: 14043 SIG: 9
我在这里缺少什么?
感谢您的帮助