我正在使用droidQuery库向我的应用程序添加一些手势检测。我在我的 xml 文件中添加 SwipeInterceptorView 时遇到问题(请参见此处的原始问题,因此我在我的onCreate方法中定义它并为其提供相同的参数。然后我使用 将它添加到我的布局中layout.addView(swipeInterceptorView)。我试图将它添加到我的XML布局文件中,但我有一个错误。
是在定义SwipeInterceptorView编程上的良好实践,还是应该将其添加到我的XML文件中?如果我应该,我该如何修复这个XML文件?:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/table"
android:orientation="vertical" >
<self.philbrown.SwipeInterceptorView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_view"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</self.philbrown.SwipeInterceptorView>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
当我使用这个布局时,我得到了Runtime error java.lang.ClassNotFoundException。
另外,我知道如何将 the 添加onClickListener到 anImageView中,但是谁能告诉我应该如何将侦听器添加到 a 中TextView?
谢谢你的帮助!